Win 8 Store XAML アプリでダイアログのような効果を実現する方法はありますか? ダイアログのコンテンツがユーザー入力を収集するためのカスタム コントロールであるこの投稿で示されているものと同様です。
上記の投稿で示したものと同様に、中央に表示したい XAML コンテンツのサンプルを次に示します。
<common:LayoutAwarePage
x:Class="App1.UserControls.Control1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
>
<Grid HorizontalAlignment="Stretch" Background="Gold" VerticalAlignment="Center">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" AreScrollSnapPointsRegular="True" Margin="20">
<TextBlock Text="This is sample text" FontSize="20" Style="{StaticResource HeaderTextStyle}"/>
<Button Content="Close" Click="btnClose_Click" Margin="0,20,0,0" HorizontalAlignment="Right"/>
</StackPanel>
</Grid></common:LayoutAwarePage>
ポップアップ コントロールを使用して、次のようにメイン ページからこれを表示しています。
<common:LayoutAwarepage>
<Grid Style="{StaticResource LayoutRootStyle}">
<Popup x:Name="ParentedPopup" VerticalOffset="300" HorizontalOffset="200"
HorizontalAlignment="Stretch">
<usercontrols:CreateCategory/>
</Popup>
</Grid>
<Page.BottomAppBar>
<AppBar x:Name="bottomAppBar" Padding="10,0,10,0">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Button Style="{StaticResource AddAppBarButtonStyle}" Click="AddButton_Click"/>
</StackPanel>
</Grid>
</AppBar>
</Page.BottomAppBar></common:LayoutAwarePage>
private void AddButton_Click(object sender, RoutedEventArgs e)
{
if (!ParentedPopup.IsOpen) { ParentedPopup.IsOpen = true; }
}
ただし、これは意図したとおりに表示されず、ポップアップには xaml コンテンツが中央に表示されず、上部に表示され、中央に配置されず、希望どおりに引き伸ばされません。
これを達成する簡単な方法はありますか?注: どのライブラリにも依存したくありません。