Skip to content

Commit

Permalink
Calc: Step 6.2: Add a DrawingIsland
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseCol committed May 9, 2024
1 parent 0eebe88 commit 41c6b9c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Samples/Islands/DrawingIsland/CalculatorDemo/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ public sealed partial class MainWindow : Window
private string _lastVal;
private string _memVal;
private AppWindow _appWindow;
private Microsoft.UI.Composition.Compositor _compositor;

public MainWindow()
{
InitializeComponent();
_paper = new PaperTrail(this);
ProcessKey('0');
EraseDisplay = true;
_compositor = new Microsoft.UI.Composition.Compositor();
}

/// <summary>
Expand Down Expand Up @@ -489,5 +491,16 @@ void SetCompactView(bool useCompactView)
_appWindow.SetPresenter(AppWindowPresenterKind.Default);
}
}

private void CreateDrawingIslandMenuItem_Click(object sender, RoutedEventArgs e)
{
var wpfIslandHost = new WpfIslandHost(_compositor);
var drawingIsland = new DrawingIslandComponents.DrawingIsland(_compositor);

// After this, the WpfIslandHost will be live, and the DesktopChildSiteBridge will be available.
DisplayAreaBorder.Child = wpfIslandHost;

wpfIslandHost.DesktopChildSiteBridge.Connect(drawingIsland.Island);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
-->
<Menu Name="MainMenu" DockPanel.Dock="Top">
<MenuItem Header="File">
<MenuItem Name="CreateDrawingIslandMenuItem" Click="CreateDrawingIslandMenuItem_Click" Header="Create DrawingIsland" />
<MenuItem Click="OnMenuExit" Header="Exit" />
</MenuItem>
<MenuItem Header="View">
Expand Down

0 comments on commit 41c6b9c

Please sign in to comment.