【问题标题】:Height of ContentDialog in UWPUWP 中 ContentDialog 的高度
【发布时间】:2016-04-17 20:49:27
【问题描述】:

如何在 UWP 应用中指定 ContentDialog 的高度?

在手机上它几乎扩展了整个页面,即使对话框内容高度是页面的三分之一。

【问题讨论】:

    标签: win-universal-app uwp-xaml


    【解决方案1】:

    很容易。在 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

    【讨论】:

    • 固定高度的问题是它取决于宽度,也很难设置固定的wince它受设备宽度的影响。有没有办法将 ContentDialog 的高度设置为它所承载的控件的高度?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-23
    • 2016-02-10
    相关资源
    最近更新 更多