【问题标题】:How to change style of title of Content Dialog in Windows Phone 8.1如何在 Windows Phone 8.1 中更改内容对话框的标题样式
【发布时间】:2015-02-03 05:53:38
【问题描述】:

如何在 Windows Phone 8.1 中更改 ContentDialog 页面的 title 属性的样式。

XAML:

<ContentDialog
    x:Class="MyApp.View.Login.ContentDialog1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyApp.View.Login"
    Title="DIALOG TITLE">

    <StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
        <TextBox Name="email" Header="Email address"/>
    </StackPanel>
</ContentDialog>

这里有Title="DIALOG TITLE",我可以更改title中的文字显示样式吗?

编辑

如果没有提及title,如何减少ContentDialog 中最顶部的空白空间?

【问题讨论】:

    标签: c# xaml windows-phone-8.1


    【解决方案1】:

    标题将显示在 ContentDialog 的TitleTemplate 中。您可以根据需要进行更改。

    <ContentDialog
        x:Class="MyApp.View.Login.ContentDialog1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:MyApp.View.Login"
        Title="DIALOG TITLE">
    
        <ContentDialog.TitleTemplate>
            <DataTemplate>
                <!-- what do you want the title to look like -->
            </DataTemplate>
        </ContentDialog.TitleTemplate>
    
        <StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
            <TextBox Name="email" Header="Email address"/>
        </StackPanel>
    </ContentDialog>
    

    【讨论】:

    • 如果窗口没有任何标题,我可以从顶部更改 ContentDialog 的默认高度吗?默认情况下,标题或窗口默认占据顶部的 50 个边距。检查已编辑的问题。
    • 我无法在 Contentdialog 的右上角添加 X 按钮。我把两个列网格放在那里,但不起作用。你能帮我吗?
    • 我只想提一下,为了在这种情况下使用标准 Title 值,您必须在模板中添加以下行:Text="{Binding}"
    猜你喜欢
    • 1970-01-01
    • 2015-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多