使用できますがPopup
、機能しMessageDialog
ません。最初に popup の UI を として作成しUsercontrol
、次に popup の子をそのユーザー コントロールとして設定する必要があります。以下にサンプルをあげました。もう 1 つのオプションはInputDialog
、 WinRT XAML Toolkitで使用できる を使用することです。
MyUserControl.xaml (適切な高さ幅を に設定<UserContol />
)
<Grid Background="Black">
<Grid.RowDefinitions>
<RowDefinition Height="21*" />
<RowDefinition Height="16*" />
<RowDefinition Height="63*" />
</Grid.RowDefinitions>
<TextBlock Text="Movies" FontSize="30" Margin="20,20,0,0"/>
<TextBlock Text="Search has been found." FontSize="15" Grid.Row="1" Margin="20,20,0,0"/>
<StackPanel Orientation="Horizontal" Grid.Row="2" Margin="20,0,0,0">
<Button Content="Yes" />
<Button Content="No" />
<Button Content="Cancel" />
</StackPanel>
</Grid>
MainPage.xaml.cs
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Popup p = new Popup();
p.Child = new MyUserControl();
p.IsOpen = true;
p.HorizontalOffset = (Window.Current.Bounds.Width - ((MyUserControl)(p.Child)).Width) / 2;
p.VerticalOffset = (Window.Current.Bounds.Height - ((MyUserControl)(p.Child)).Height) / 2;
}