2017-05-17 76 views

回答

0

如此地: How to change Highlight color of the selected ListView item in UWP (Windows 10)

更改現有資源

Application.Current.Resources["SystemControlHighlightListAccentLowBrush"] = new SolidColorBrush(Colors.Red); 
Application.Current.Resources["SystemControlHighlightListAccentMediumBrush"] = new SolidColorBrush(Colors.Red); 

或定義自己的ListViewItemPresenter

+0

它不工作 – Renjith

+0

你在哪裏使用這行代碼?在原生UWP項目的App.cs中? – puko

+0

上午用它在本地UWP MainPage.xaml.cs中 – Renjith

0

瀏覽到您的UWP項目,打開你的App.xaml,並將下面:

<Application.Resources> 
    <ResourceDictionary> 
     <ResourceDictionary.ThemeDictionaries> 
     <ResourceDictionary x:Key="Default"> 

<!--Your accent color--> 
<Color x:Key="SystemAccentColor">#FF055ADA</Color>     

<SolidColorBrush x:Key="SystemControlHighlightAltListAccentHighBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.9" /> 
<SolidColorBrush x:Key="SystemControlHighlightAltListAccentLowBrush" Color="ThemeResource SystemAccentColor}" Opacity="0.6" /> 
<SolidColorBrush x:Key="SystemControlHighlightAltListAccentMediumBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.8" /> 
<SolidColorBrush x:Key="SystemControlHighlightListAccentHighBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.9" /> 
<SolidColorBrush x:Key="SystemControlHighlightListAccentLowBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.6" /> 
<SolidColorBrush x:Key="SystemControlHighlightListAccentMediumBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.8" /> 

    </ResourceDictionary> 
    </ResourceDictionary.ThemeDictionaries> 
</ResourceDictionary> 
</Application.Resources> 

這應該通過覆蓋默認的UWP ResourceDictionary.ThemeDictionaries