File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Samples/Islands/DrawingIsland/CalculatorDemo Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 113
113
<DependentUpon >Settings.settings</DependentUpon >
114
114
<DesignTimeSharedInput >True</DesignTimeSharedInput >
115
115
</Compile >
116
+ <Compile Include =" WpfIslandHost.cs" />
116
117
<EmbeddedResource Include =" Properties\Resources.resx" >
117
118
<Generator >ResXFileCodeGenerator</Generator >
118
119
<LastGenOutput >Resources.Designer.cs</LastGenOutput >
Original file line number Diff line number Diff line change
1
+ using Microsoft . UI . Composition ;
2
+ using Microsoft . UI . Content ;
3
+ using System . Runtime . InteropServices ;
4
+ using System . Windows . Interop ;
5
+
6
+ namespace CalculatorDemo
7
+ {
8
+ internal class WpfIslandHost : HwndHost
9
+ {
10
+ public WpfIslandHost ( Compositor compositor )
11
+ {
12
+ _compositor = compositor ;
13
+ }
14
+
15
+ public DesktopChildSiteBridge DesktopChildSiteBridge { get ; private set ; }
16
+
17
+ protected override HandleRef BuildWindowCore ( HandleRef hwndParent )
18
+ {
19
+ DesktopChildSiteBridge = Microsoft . UI . Content . DesktopChildSiteBridge . Create (
20
+ _compositor ,
21
+ new Microsoft . UI . WindowId ( ( ulong ) hwndParent . Handle ) ) ;
22
+
23
+ return new HandleRef ( null , ( nint ) DesktopChildSiteBridge . WindowId . Value ) ;
24
+ }
25
+
26
+ protected override void DestroyWindowCore ( HandleRef hwnd )
27
+ {
28
+ DesktopChildSiteBridge . Dispose ( ) ;
29
+ DesktopChildSiteBridge = null ;
30
+ }
31
+
32
+ Microsoft . UI . Composition . Compositor _compositor ;
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments