【发布时间】:2016-04-17 20:49:27
【问题描述】:
如何在 UWP 应用中指定 ContentDialog 的高度?
在手机上它几乎扩展了整个页面,即使对话框内容高度是页面的三分之一。
【问题讨论】:
标签: win-universal-app uwp-xaml
如何在 UWP 应用中指定 ContentDialog 的高度?
在手机上它几乎扩展了整个页面,即使对话框内容高度是页面的三分之一。
【问题讨论】:
标签: win-universal-app uwp-xaml
很容易。在 XAML 中执行:
<ContentDialog x:Name="MyContentDialog" Height="100" Width="150"
Title="Lorem Ipsum"
PrimaryButtonText="OK" IsPrimaryButtonEnabled="True">
<StackPanel Width="150" Height="100">
<TextBlock Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit" TextWrapping="Wrap" />
</StackPanel>
</ContentDialog>
或者使用 MaxHeight 属性。
这是很好的链接Windows 10 XAML Tips: MessageDialog and ContentDialog
如果您的内容过多 - 您可以尝试在 ContentDialog 中放置 ScrollViewer 或更新 ContentDialog default style
【讨论】: