Search code examples
wpfdatagridcolumnheader

How can I change or remove DataGridColumnHeader vertical line color wpf?


How can I change DataGridColumnHeader vertical line color?

I used SeparatorBrush transparent, and SeparatorVisibility hidden, but there were not work.

I can draw border , but basic separator show continued.

How can I fix it...?

          ↓

enter image description here

  <Style x:Key="DataGridHeaderStyle" BasedOn="{StaticResource MetroDataGridColumnHeader}" TargetType="{x:Type DataGridColumnHeader}">
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="Background" Value="{StaticResource DataGridRow_2}"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="BorderBrush" Value="{StaticResource DataGrid_HeaderUnderLine}"/>
            <Setter Property="BorderThickness" Value="0,0,1,2"/>
            <Setter Property="SeparatorVisibility" Value="Collapsed"/>
        </Style>

Solution

  • You can set the separator visibility to collapsed and it works.

    <DataGrid.ColumnHeaderStyle>
        <Style TargetType="{x:Type DataGridColumnHeader}">
            <Setter Property="SeparatorVisibility" Value="Collapsed"/>
        </Style>
    </DataGrid.ColumnHeaderStyle>