Xaml 如何更改windows通用应用程序的默认强调色?

Xaml 如何更改windows通用应用程序的默认强调色?,xaml,windows-phone-8.1,win-universal-app,Xaml,Windows Phone 8.1,Win Universal App,我想将我的应用程序(windows universal app)中的强调色从默认颜色更改为在我的应用程序中定义的自定义颜色 你知道我该怎么做吗?你试过使用: (App.Current.Resources["PhoneAccentBrush"] as SolidColorBrush).Color = Colors.Blue; 在你的App.xaml.cs?中,我在Microsoft论坛上找到了这个,并帮助我解决了这个问题: 您无法真正更改应用程序中的基本强调色,因为它是由系统主题颜色(任务栏、开

我想将我的应用程序(windows universal app)中的强调色从默认颜色更改为在我的应用程序中定义的自定义颜色

你知道我该怎么做吗?

你试过使用:

(App.Current.Resources["PhoneAccentBrush"] as SolidColorBrush).Color = Colors.Blue;

在你的App.xaml.cs?

中,我在Microsoft论坛上找到了这个,并帮助我解决了这个问题:


您无法真正更改应用程序中的基本强调色,因为它是由系统主题颜色(任务栏、开始菜单等)定义的。但是,可以使用样式修改强调色。下面是一个例子:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App1">

    <!-- Basic Colors -->
    <SolidColorBrush x:Key="SystemAccentTransparentHighBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.9"/>
    <SolidColorBrush x:Key="SystemAccentTransparentMediumHighBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.7" />
    <SolidColorBrush x:Key="SystemAccentTransparentMediumBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.6" />
    <SolidColorBrush x:Key="SystemAccentTransparentMediumLowBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.5" />
    <SolidColorBrush x:Key="SystemAccentTransparentLowBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.3" />
    <SolidColorBrush x:Key="SystemAccentHighlightBrush" Color="{ThemeResource SystemAccentColor}" />
    <SolidColorBrush x:Key="SystemBlackBrush" Color="{ThemeResource SystemChromeBlackHighColor}" />
    <SolidColorBrush x:Key="SystemWhiteBrush" Color="{ThemeResource SystemChromeWhiteColor}" />
    <SolidColorBrush x:Key="SystemGreyHighBrush" Color="#FFE0E0E0" />
    <SolidColorBrush x:Key="SystemGreyMediumHighBrush" Color="#FFA0A0A0" />
    <SolidColorBrush x:Key="SystemGreyMediumBrush" Color="#FF808080" />
    <SolidColorBrush x:Key="SystemGreyMediumLowBrush" Color="#FF606060" />
    <SolidColorBrush x:Key="SystemGreyLowBrush" Color="#FF404040" />
    <SolidColorBrush x:Key="SystemAppBackgroundBrush" Color="{ThemeResource ApplicationPageBackgroundThemeBrush}" />

    <Style x:Key="GridStyle_Page" TargetType="Grid">
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
        <Setter Property="Background" Value="{StaticResource SystemBlackBrush}" />
    </Style>

</ResourceDictionary>
我希望这有帮助,并为迟来的答复感到抱歉。我只是在谷歌搜索其他东西时遇到了你的问题

<Application
    x:Class="App1.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App1"
    RequestedTheme="Light">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.10240.0\Generic