File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed
Samples/Islands/DrawingIsland/CalculatorDemo Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 113113 <DependentUpon >Settings.settings</DependentUpon >
114114 <DesignTimeSharedInput >True</DesignTimeSharedInput >
115115 </Compile >
116+ <Compile Include =" WpfIslandHost.cs" />
116117 <EmbeddedResource Include =" Properties\Resources.resx" >
117118 <Generator >ResXFileCodeGenerator</Generator >
118119 <LastGenOutput >Resources.Designer.cs</LastGenOutput >
Original file line number Diff line number Diff line change 137137 Also, make the TextBox borders a little less harsh.
138138 -->
139139 <local : MyTextBox Grid.ColumnSpan=" 9" x : Name =" DisplayBox" Height =" 30" Margin =" 5" FontSize =" 20" BorderBrush =" LightGray" />
140- <local : MyTextBox Grid.Row=" 1" Grid.ColumnSpan=" 3" Grid.RowSpan=" 5" Margin =" 5" x : Name =" PaperBox" BorderBrush =" LightGray" />
140+ <Border Name =" DisplayAreaBorder" Grid.Row=" 1" Grid.ColumnSpan=" 3" Grid.RowSpan=" 5" Margin =" 5" >
141+ <local : MyTextBox x : Name =" PaperBox" BorderBrush =" LightGray" />
142+ </Border >
141143 </Grid >
142144
143145 </DockPanel >
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