locked
Listbox background

    Question

  • Hi:

    Unable to change color of ListBox (WinRT) Backgroubd= Transparent works only design time. Runtime it becomes again white. Also how to set selection color to Transparent or no color.


    Agha Khan

    Friday, May 9, 2014 5:32 AM

Answers

  • Thanks for reply.Found the solution.

    <SolidColorBrush x:Key="ListBoxBackgroundThemeBrush" Color="Transparent" />
     <SolidColorBrush x:Key="ListBoxFocusBackgroundThemeBrush" Color="Transparent" />
     <SolidColorBrush x:Key="ListBoxItemPressedBackgroundThemeBrush" Color="Transparent" />
     <SolidColorBrush x:Key="ListBoxItemSelectedPointerOverBackgroundThemeBrush" Color="Transparent" />
     <SolidColorBrush x:Key="ListBoxItemSelectedBackgroundThemeBrush" Color="Transparent" />

    Please check this link

    Link


    Agha Khan

    Friday, May 9, 2014 7:10 AM

All replies

  • Hi, please open App.xaml file, put below brush overrides the default ListBox control template to brush:

    <SolidColorBrush x:Key="ListBoxBackgroundThemeBrush" Color="Transparent" />
    <SolidColorBrush x:Key="ListBoxFocusBackgroundThemeBrush" Color="Transparent" />

    For example:

    <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">
    
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="Common/StandardStyles.xaml"/>
                </ResourceDictionary.MergedDictionaries>
                <SolidColorBrush x:Key="ListBoxBackgroundThemeBrush" Color="Transparent" />
                <SolidColorBrush x:Key="ListBoxFocusBackgroundThemeBrush" Color="Transparent" />
            </ResourceDictionary>
        </Application.Resources>
    </Application>
    

    Friday, May 9, 2014 5:56 AM
  • Thanks for reply. Partially it works. Mouse down brings selection white and Mouse up brings kind of blue. I
    don’t want any color for selection or transparent color.

    Agha Khan

    Friday, May 9, 2014 6:36 AM
  • Thanks for reply.Found the solution.

    <SolidColorBrush x:Key="ListBoxBackgroundThemeBrush" Color="Transparent" />
     <SolidColorBrush x:Key="ListBoxFocusBackgroundThemeBrush" Color="Transparent" />
     <SolidColorBrush x:Key="ListBoxItemPressedBackgroundThemeBrush" Color="Transparent" />
     <SolidColorBrush x:Key="ListBoxItemSelectedPointerOverBackgroundThemeBrush" Color="Transparent" />
     <SolidColorBrush x:Key="ListBoxItemSelectedBackgroundThemeBrush" Color="Transparent" />

    Please check this link

    Link


    Agha Khan

    Friday, May 9, 2014 7:10 AM