如何在Windows Phone 8.1中更改内容对话框的标题样式

时间:2015-02-03 05:53:39

标签: c# xaml windows-phone-8.1

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

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中的文字样式吗?

修改

enter image description here

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

1 个答案:

答案 0 :(得分:5)

标题将显示在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>