views:

286

answers:

1

While reskining GridView (ListView with more columns), I ran into a problem, that I couldn't change the color of the Highlighted row. I searched the internet and found out, that adding this can help.

<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" 
                 Color="Transparent" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" 
                 Color="Transparent" />

This solved the issue for some people but it didnt help me. The Highlight color was still in system default. I finally managed to change the color of the selected row, but the highlight is still visible around the border of the row plus i need to get rid of the Highlight in the ColumnHeaders.

Heres the code, where my approach doesn't work:

<ListView >
 <ListView.Resources>
  <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" 
                   Color="Transparent" />
  <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" 
                   Color="Transparent" />
 </ListView.Resources>
 <ListView.View>
  <GridView>
   <GridViewColumn Header="a"/>
   <GridViewColumn Header="b"/>
  </GridView>
 </ListView.View>
 <ListViewItem>sth</ListViewItem>
 <ListViewItem>sthelse</ListViewItem>
</ListView>
A: 

Hi

if I truly understand, you want to remove Highlight color. if you want to do this, this is simple. Use this style:

<Style x:Key="SimpleListViewItem" TargetType="ListViewItem">
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
</Style>

but for using this style you must use that style for ItemContainerStyle property.

I hope this solution help you.

regards Rev

Rev
Added this to the ItemContainerStyle but gridview still resisting. ListView works fine with this change (but even my solution managed to resolve the normal listview). :-(
Can u post your code !(full code about gridview)
Rev