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
2323 private string _lastVal ;
2424 private string _memVal ;
2525 private AppWindow _appWindow ;
26+ private Microsoft . UI . Composition . Compositor _compositor ;
2627
2728 public MainWindow ( )
2829 {
2930 InitializeComponent ( ) ;
3031 _paper = new PaperTrail ( this ) ;
3132 ProcessKey ( '0' ) ;
3233 EraseDisplay = true ;
34+ _compositor = new Microsoft . UI . Composition . Compositor ( ) ;
3335 }
3436
3537 /// <summary>
@@ -489,5 +491,16 @@ void SetCompactView(bool useCompactView)
489491 _appWindow . SetPresenter ( AppWindowPresenterKind . Default ) ;
490492 }
491493 }
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+ }
492505 }
493506}
Original file line number Diff line number Diff line change 3838 -->
3939 <Menu Name =" MainMenu" DockPanel.Dock=" Top" >
4040 <MenuItem Header =" File" >
41+ <MenuItem Name =" CreateDrawingIslandMenuItem" Click =" CreateDrawingIslandMenuItem_Click" Header =" Create DrawingIsland" />
4142 <MenuItem Click =" OnMenuExit" Header =" Exit" />
4243 </MenuItem >
4344 <MenuItem Header =" View" >
You can’t perform that action at this time.
0 commit comments