File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Samples/Islands/DrawingIsland/CalculatorDemo Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,15 @@ public sealed partial class MainWindow : Window
23
23
private string _lastVal ;
24
24
private string _memVal ;
25
25
private AppWindow _appWindow ;
26
+ private Microsoft . UI . Composition . Compositor _compositor ;
26
27
27
28
public MainWindow ( )
28
29
{
29
30
InitializeComponent ( ) ;
30
31
_paper = new PaperTrail ( this ) ;
31
32
ProcessKey ( '0' ) ;
32
33
EraseDisplay = true ;
34
+ _compositor = new Microsoft . UI . Composition . Compositor ( ) ;
33
35
}
34
36
35
37
/// <summary>
@@ -489,5 +491,16 @@ void SetCompactView(bool useCompactView)
489
491
_appWindow . SetPresenter ( AppWindowPresenterKind . Default ) ;
490
492
}
491
493
}
494
+
495
+ private void CreateDrawingIslandMenuItem_Click ( object sender , RoutedEventArgs e )
496
+ {
497
+ var wpfIslandHost = new WpfIslandHost ( _compositor ) ;
498
+ var drawingIsland = new DrawingIslandComponents . DrawingIsland ( _compositor ) ;
499
+
500
+ // After this, the WpfIslandHost will be live, and the DesktopChildSiteBridge will be available.
501
+ DisplayAreaBorder . Child = wpfIslandHost ;
502
+
503
+ wpfIslandHost . DesktopChildSiteBridge . Connect ( drawingIsland . Island ) ;
504
+ }
492
505
}
493
506
}
Original file line number Diff line number Diff line change 38
38
-->
39
39
<Menu Name =" MainMenu" DockPanel.Dock=" Top" >
40
40
<MenuItem Header =" File" >
41
+ <MenuItem Name =" CreateDrawingIslandMenuItem" Click =" CreateDrawingIslandMenuItem_Click" Header =" Create DrawingIsland" />
41
42
<MenuItem Click =" OnMenuExit" Header =" Exit" />
42
43
</MenuItem >
43
44
<MenuItem Header =" View" >
You can’t perform that action at this time.
0 commit comments