locked
Metro ListView selection color modification in XAML RRS feed

  • Question

  • I am developing a metro app using XAML. Trying to modify the default selection color of a list view(or in general for the complete app) which is coming purple by default. I've found a couple of threads but nothing seems to be working for providing a new selection color.

    Has anyone done this before, please help me out with this.

    Sunday, July 22, 2012 7:29 PM

Answers

  • you can create and edit the copy of the control template as sivalingan suggests.

    But if you are going to be using the same selected item color for other listviews in your app, you can edit the StandardStyles.xaml as follows:

    <ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">    
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Default">
    <!-- ... -->
                <SolidColorBrush x:Key="ListViewItemSelectedBackgroundThemeBrush" Color="#00abdc"></SolidColorBrush>
                <SolidColorBrush x:Key="ListViewItemPointerOverBackgroundThemeBrush" Color="#ffffff"></SolidColorBrush>
                <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBackgroundThemeBrush" Color="#de00abdc"></SolidColorBrush>
                <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBorderThemeBrush" Color="#ab00abdc"></SolidColorBrush>
    <!-- ... -->
            </ResourceDictionary>
    
    <!-- ... -->
        </ResourceDictionary.ThemeDictionaries>
    <!-- ... -->
    </ResourceDictionary>


    Can Bilgin
    Blog CompuSight

    Monday, July 23, 2012 12:07 PM

All replies

  • Open your project with Expression blend

    Right click the list view in the Objects and Timeline window

    Edit a Template  --> Edit a Copy

    And then Change the Style with your own style



    Sivalingam

    Monday, July 23, 2012 5:59 AM
  • you can create and edit the copy of the control template as sivalingan suggests.

    But if you are going to be using the same selected item color for other listviews in your app, you can edit the StandardStyles.xaml as follows:

    <ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">    
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Default">
    <!-- ... -->
                <SolidColorBrush x:Key="ListViewItemSelectedBackgroundThemeBrush" Color="#00abdc"></SolidColorBrush>
                <SolidColorBrush x:Key="ListViewItemPointerOverBackgroundThemeBrush" Color="#ffffff"></SolidColorBrush>
                <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBackgroundThemeBrush" Color="#de00abdc"></SolidColorBrush>
                <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBorderThemeBrush" Color="#ab00abdc"></SolidColorBrush>
    <!-- ... -->
            </ResourceDictionary>
    
    <!-- ... -->
        </ResourceDictionary.ThemeDictionaries>
    <!-- ... -->
    </ResourceDictionary>


    Can Bilgin
    Blog CompuSight

    Monday, July 23, 2012 12:07 PM
  • Hi

    I'm just getting started with Windows 8 development and I found this thread really helpful.  I was wondering if you could clarify what each brush is for please, as I have found this confusing. I know "ListViewItemSelectedBackgroundThemeBrush" changes the background colour of the selected item indicator but I assumed "ListViewItemPointerOverBackgroundThemeBrush" would change the checkmark colour.  This isn't the case and even though I've been experimenting I can't seem to figure out what the last three are for.  Is there a resource that explains these brushes?

    Thanks..

    Wednesday, November 28, 2012 11:42 AM