Skip to content

Commit 96fc451

Browse files
committed
Make the calc work in compact mode
1 parent 3fd34bd commit 96fc451

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Samples/Islands/WpfCalculator/CalculatorDemo/MainWindow_Demo3.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ void SetCompactView(bool useCompactView)
4242

4343
CompactViewText.Text = DisplayBox.Text;
4444

45+
if (!_registeredEventHandler)
46+
{
47+
DisplayBox.TextChanged += DisplayBox_TextChanged;
48+
_registeredEventHandler = true;
49+
}
50+
4551
// The AppWindow's CompactOverlay mode will make it always-on-top.
4652
_appWindow.SetPresenter(AppWindowPresenterKind.CompactOverlay);
4753
_appWindow.ResizeClient(new Windows.Graphics.SizeInt32(400, 400));
@@ -54,5 +60,12 @@ void SetCompactView(bool useCompactView)
5460
_appWindow.SetPresenter(AppWindowPresenterKind.Default);
5561
}
5662
}
57-
}
63+
64+
private void DisplayBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
65+
{
66+
CompactViewText.Text = DisplayBox.Text;
67+
}
68+
69+
bool _registeredEventHandler = false;
70+
}
5871
}

0 commit comments

Comments
 (0)