Anyone know how to style the header hover color of a WPF ListView?
Thanks!
From stackoverflow
-
You have to create style for GridView.ColumnHeaderContainerStyle property. Add the hover effect by setting some trigger to the Style. sample XAML bellow
<ListView VerticalAlignment="Bottom" Height="63" IsSynchronizedWithCurrentItem="True"> <ListView.View> <GridView ColumnHeaderContainerStyle="{StaticResource GridViewColumnHeaderStyle1}" > <GridViewColumn/> </GridView> </ListView.View> </ListView>And the Style can be created as bellow, the bellow code will create Green color on hover over
<Style x:Key="GridViewColumnHeaderStyle1" TargetType="{x:Type GridViewColumnHeader}"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Setter Property="Background" Value="Green"/> </Trigger> </Style.Triggers> </Style>xanadont : Dude, thank you. Rock on! -
This doesn't work for me on Vista. Default colors are applied.
Any workarounds?
Deniz Dogan : I'm not sure, but try setting `OverridesDefaultStyle` to `True`. This should prevent Windows from applying any default styles to the control, if I remember correctly.
0 comments:
Post a Comment