After my last post I came across another common WPF task that could result in excruciating frustration if you're not using Expression Blend (or you just don't know enough about this shit nice framework): setting the color of the selected item in a ListView.
This is how you do it:
<ListView>
<ListView.Style>
<Style TargetType="{x:Type ListView}">
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="0"/>
<!-- here we go -->
<Style.Resourcesgt>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Black"/>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Gray"/>
</Style.Resources>
</Style>
</ListView.Style>
<!-- other stuff -->
<ListView>
Hope it helps - if so you can express your gratitude by randomly upvoting some of my answers on stackoverflow.
4 comments:
Thanks, this really helped :D
Hello
Cool Blog!
but:Perhaps, there is a failure in your code:
is the "gt" not false?
If you combine this with http://dotnetbutchering.blogspot.com/2009/08/how-to-set-wpf-listview-alternate-row.html, the result does not work on Windows 7/Aero.
If you combine this example with http://dotnetbutchering.blogspot.com/2009/08/how-to-set-wpf-listview-alternate-row.html the result does not work with Windows 7/Aero.
Post a Comment