Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 是否可以在xaml winrt应用程序中创建自定义主题笔刷?_.net_Xaml_Windows Runtime - Fatal编程技术网

.net 是否可以在xaml winrt应用程序中创建自定义主题笔刷?

.net 是否可以在xaml winrt应用程序中创建自定义主题笔刷?,.net,xaml,windows-runtime,.net,Xaml,Windows Runtime,我想在我的应用程序中创建一个solidbrush资源,该资源将根据所选主题更改颜色 还有什么办法吗?好吧,我想出来了。在StandardStyles.xaml中有一个部分 在这里,您可以为每个不同的主题添加相同的实心笔刷元素 <ResourceDictionary.ThemeDictionaries> <ResourceDictionary x:Key="Default"> <x:String x:Key="BackButtonGlyph"&

我想在我的应用程序中创建一个solidbrush资源,该资源将根据所选主题更改颜色


还有什么办法吗?

好吧,我想出来了。在StandardStyles.xaml中有一个部分

在这里,您可以为每个不同的主题添加相同的实心笔刷元素

<ResourceDictionary.ThemeDictionaries>
    <ResourceDictionary x:Key="Default">
        <x:String x:Key="BackButtonGlyph">&#xE071;</x:String>
        <x:String x:Key="BackButtonSnappedGlyph">&#xE0BA;</x:String>
        <SolidColorBrush x:Key="ListViewItemSelectedBackgroundThemeBrush" Color="#CEE3F8"></SolidColorBrush>
        <SolidColorBrush x:Key="ListViewItemPointerOverBackgroundThemeBrush" Color="#E0E0E0"></SolidColorBrush>
        <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBackgroundThemeBrush" Color="#CEE3F8"></SolidColorBrush>
        <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBorderThemeBrush" Color="#CEE3F8"></SolidColorBrush>
        <SolidColorBrush x:Key="HeaderBrush" Color="#FF8AA1B8">

        </SolidColorBrush>
    </ResourceDictionary>
    <ResourceDictionary x:Key="Light">
        <SolidColorBrush x:Key="HeaderBrush" Color="#FFCEE3F8">

        </SolidColorBrush>
    </ResourceDictionary>
    <ResourceDictionary x:Key="HighContrast">
        <x:String x:Key="BackButtonGlyph">&#xE0A6;</x:String>
        <x:String x:Key="BackButtonSnappedGlyph">&#xE0C4;</x:String>
    </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
在这里,我添加了一个轻主题,并在其中两个主题中添加了一个名为HeaderBrush的实心笔刷

要实现这个笔刷,只需将它作为资源添加到元素中。就像这样

<AppBar x:Name="BottomAppBar1"   Padding="10,0,10,0" BorderBrush="Blue"  BorderThickness="0 1 0 0" Background="{ThemeResource HeaderBrush}"  AutomationProperties.Name="Bottom App Bar" Opened="BottomAppBar1_Opened" Closed="BottomAppBar1_Closed">

在这里,我将画笔设置为背景色,现在它会随着主题自动改变。

好的,我想出来了。在StandardStyles.xaml中有一个部分

在这里,您可以为每个不同的主题添加相同的实心笔刷元素

<ResourceDictionary.ThemeDictionaries>
    <ResourceDictionary x:Key="Default">
        <x:String x:Key="BackButtonGlyph">&#xE071;</x:String>
        <x:String x:Key="BackButtonSnappedGlyph">&#xE0BA;</x:String>
        <SolidColorBrush x:Key="ListViewItemSelectedBackgroundThemeBrush" Color="#CEE3F8"></SolidColorBrush>
        <SolidColorBrush x:Key="ListViewItemPointerOverBackgroundThemeBrush" Color="#E0E0E0"></SolidColorBrush>
        <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBackgroundThemeBrush" Color="#CEE3F8"></SolidColorBrush>
        <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBorderThemeBrush" Color="#CEE3F8"></SolidColorBrush>
        <SolidColorBrush x:Key="HeaderBrush" Color="#FF8AA1B8">

        </SolidColorBrush>
    </ResourceDictionary>
    <ResourceDictionary x:Key="Light">
        <SolidColorBrush x:Key="HeaderBrush" Color="#FFCEE3F8">

        </SolidColorBrush>
    </ResourceDictionary>
    <ResourceDictionary x:Key="HighContrast">
        <x:String x:Key="BackButtonGlyph">&#xE0A6;</x:String>
        <x:String x:Key="BackButtonSnappedGlyph">&#xE0C4;</x:String>
    </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
在这里,我添加了一个轻主题,并在其中两个主题中添加了一个名为HeaderBrush的实心笔刷

要实现这个笔刷,只需将它作为资源添加到元素中。就像这样

<AppBar x:Name="BottomAppBar1"   Padding="10,0,10,0" BorderBrush="Blue"  BorderThickness="0 1 0 0" Background="{ThemeResource HeaderBrush}"  AutomationProperties.Name="Bottom App Bar" Opened="BottomAppBar1_Opened" Closed="BottomAppBar1_Closed">

在这里,我将画笔设置为背景色,现在它会随着主题自动改变。

我们如何在UWP中完成相同的事情?我们如何在UWP中完成相同的事情?