Hi All,
I am working on a wpf project. I need a group and sort listview. I need to change style of header, cell and group of listview. I write GridViewColumn as the following:
<GridViewColumn DisplayMemberBinding="{Binding ErrorText,Mode=OneWay}" x:Name="AlarmColumn" Width="auto" ><GridViewColumn.HeaderContainerStyle><Style TargetType="GridViewColumnHeader"><Setter Property="Background" Value="#626262"/><Setter Property="VerticalAlignment" Value="Center"/><Setter Property="VerticalContentAlignment" Value="Center"/><Setter Property="HorizontalAlignment" Value="Left"/><Setter Property="Content" Value="Alarm"/><Setter Property="Height" Value="25"/><Setter Property="Padding" Value="10,0"/><Setter Property="Width" Value="Auto"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="GridViewColumnHeader"><Grid ><Border Name="HeaderBorder" Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" Width="{TemplateBinding Width}"><ContentPresenter Name="HeaderContent" TextElement.Foreground="White" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="False" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /></Border></Grid></ControlTemplate></Setter.Value></Setter></Style></GridViewColumn.HeaderContainerStyle></GridViewColumn>
There is a problem that the header width doesn't equal the width of its column. Anyone knows why?
BTW how to change the cell style of listview?
Thanks.