我正在尝试创建一个windows8.1应用程序,想知道有没有一个控件可以让我在XAML中创建一些类似弹出窗口或消息框的东西,它覆盖了大约80%的屏幕,并在屏幕的两侧留出了一些空白处?就像当我们点击一个按钮时,屏幕的亮度变暗了,除了打开的弹出窗口。作为一个例子,我附上了一张图片。Example from windows settings
发布于 2015-11-19 05:26:16
除了MessageBox之外,没有一个收件箱控件可以做到这一点。在Xaml中实现自己相当容易,只需创建一个具有部分不透明背景的Grid,并将控件放在三行中间。在此实现中,行和列的大小将与放置在中心的控件一致。如果您愿意,也可以更直接地设置这些大小。
<Grid Background="{ThemeResource DimmedBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Coloured background for the center row -->
<Rectangle Grid.Row="1" Grid.ColumnSpan="3" Fill="{ThemeResource AppThemeBrush}" />
<!-- User control with the contents in the center row + column -->
<local:MyControls Grid.Row="1" Grid.Column="1" />
</Grid>有一些第三方库包含这样的控件。例如,请参阅Callisto的CustomDialog。
https://stackoverflow.com/questions/33790031
复制相似问题