2013年5月21日 星期二

[Windows 8] How to make Metro ListView selection color modification in XAML

Add the following xaml tag
    <SolidColorBrush x:Key="ListViewItemSelectedBackgroundThemeBrush" Color="#FF8FC249"/> 
    <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBackgroundThemeBrush" Color="#DE8FC249"/> 
    <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBorderThemeBrush" Color="#AB8FC249"/>

to StandardStyles.xaml file, and reference the following:
<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 
    
    <!-- Non-brush values that vary across themes --> 
    
    <ResourceDictionary.ThemeDictionaries> 
        <ResourceDictionary x:Key="Default"> 
            <x:String x:Key="BackButtonGlyph"></x:String> 
            <x:String x:Key="BackButtonSnappedGlyph"></x:String> 
        </ResourceDictionary> 
        
        <ResourceDictionary x:Key="HighContrast"> 
            <x:String x:Key="BackButtonGlyph"></x:String> 
            <x:String x:Key="BackButtonSnappedGlyph"></x:String> 
        </ResourceDictionary> 
    </ResourceDictionary.ThemeDictionaries> 
    
    <x:String x:Key="ChevronGlyph"></x:String> 
    
    <SolidColorBrush x:Key="ListViewItemSelectedBackgroundThemeBrush" Color="#FF8FC249"/> 
    <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBackgroundThemeBrush" Color="#DE8FC249"/> 
    <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBorderThemeBrush" Color="#AB8FC249"/>
    ...
</ResourceDictionary> 

沒有留言:

張貼留言