Xaml Callisto自定义对话框Windows应用程序的自定义样式

Xaml Callisto自定义对话框Windows应用程序的自定义样式,xaml,windows-runtime,winrt-xaml,win-universal-app,callisto,Xaml,Windows Runtime,Winrt Xaml,Win Universal App,Callisto,除了背景之外,有没有其他方法可以自定义Callisto自定义对话框的样式?我想更改自定义对话框标题属性的字体大小和颜色。有没有不影响基本风格的建议 参考:CustomDialog的模板将其标题的前景计算为与背景形成对比的颜色,并将FontSize设置为26.6667: <StackPanel Margin="13,19,13,25" HorizontalAlignment="Center" Width="{TemplateBinding Width}" MaxWidth="680">

除了背景之外,有没有其他方法可以自定义Callisto自定义对话框的样式?我想更改自定义对话框标题属性的字体大小和颜色。有没有不影响基本风格的建议


参考:

CustomDialog的模板将其标题的前景计算为与背景形成对比的颜色,并将FontSize设置为26.6667:

<StackPanel Margin="13,19,13,25" HorizontalAlignment="Center" Width="{TemplateBinding Width}" MaxWidth="680"> 
    <local:DynamicTextBlock Foreground="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Background, Converter={StaticResource ColorContrast}}" x:Name="PART_Title" Text="{TemplateBinding Title}" FontFamily="Segoe UI" FontSize="26.6667" FontWeight="Light" Margin="0,0,0,8" /> 
    <ContentPresenter Margin="0" x:Name="PART_Content" Foreground="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Background, Converter={StaticResource ColorContrast}}" /> 
</StackPanel> 

如果要更改这些,则需要重新模板化对话框。可以从中复制模板,然后替换“前景”和“字体大小”属性。您可能希望使用TemplateBinding,以便在调用CustomDialog时可以在CustomDialog上进行设置:

<StackPanel Margin="9,5" HorizontalAlignment="Center" Width="{TemplateBinding Width}" MaxWidth="680">
    <callisto:DynamicTextBlock Foreground="{TemplateBinding Foreground}" x:Name="PART_Title" Text="{TemplateBinding Title}" FontFamily="Segoe UI" FontSize="{TemplateBinding FontSize}" FontWeight="Light" Margin="0,0,0,8" />
    <ContentPresenter Margin="0" x:Name="PART_Content" Foreground="{TemplateBinding Foreground}" />
</StackPanel>

然后将它们设置为您自己的资源:

<callisto:CustomDialog Background="{ThemeResource MyCustomDialogBackground}" Foreground="{ThemeResource MyCustomDialogForeground}" Title="Lorem ipsum" Template="{StaticResource CustomDialogControlTemplate1}"></callisto:CustomDialog>


谢谢!这似乎是我想要的方向。在模板中引用“ThemeResource”复制样式时,您是否遇到任何问题?我不知道如何让这些工作。您是否必须将每个“ThemeResource”设置复制到您的样式?这确实奏效了。我只需要复制一些ThemeResources,并为一个转换器设置正确的指令。工作得很好!非常感谢你的帮助。