戻るやウィンドウズキーがソフトキーの場合があるので
表示領域の取得には ApplicationView.VisibleBounds を使用します。
[MainPage.xaml]
<Popup SizeChanged="Popup_SizeChanged"> <Grid> <!-- コンテンツ --> </Grid> </Popup> |
[MainPage.xaml.cs]
private void Popup_SizeChanged(object sender, Windows.UI.Xaml.SizeChangedEventArgs e) { var popup = (Windows.UI.Xaml.Controls.Primitives.Popup)sender; var grid = (Windows.UI.Xaml.Controls.Grid)popup.Child; var bounds = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds; grid.Width = bounds.Width; grid.Height = bounds.Height; } |
【参考】
UWPで戻るボタンなどがソフトキーの場合の表示領域の取り方 – かずきのBlog@hatena