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

标签 c# xaml windows-phone-8.1

如何在 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 中显示的文本样式吗?

编辑

enter image description here

如果未提及 title,如何减少 ContentDialog 中最顶部的空白区域?

最佳答案

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

关于c# - 如何在 Windows Phone 8.1 中更改内容对话框的标题样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28292242/

相关文章:

c# - 如何在 LINQ 中选择查询时存储变量?

c# - 为什么数组不能被修剪?

c# - 如何从针对完整 .NET Framework 的 .NET SDK csproj 中删除默认/锁定的程序集引用?

c# - Windows 8 Metro 专注于网格

c# - ResourceDictionary 中的自定义 TabItem

c# - 如何在应用程序启动时预加载 XAML?

c# - 绘制矩形时出现这种奇怪异常的原因是什么?如何确定?

windows-phone-8 - 如何更改外部矩形的不透明度?

winrt-xaml - PasswordCredentials.Password 在 PasswordVault 中始终为空

windows-phone - Windows Phone 8.1 中是否有替代 BackgroundTask 的方法?