We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to remove the gridline of WPF DataGrid (SfDataGrid) with grouping?

Platform: WPF |
Control: SfDataGrid

WPF DataGrid (SfDataGrid) having grid lines for each row and column. But we can remove the grid lines for default row by write style for BorderThickness of GridCell. And remove the grid lines for caption row by write style for BorderThickness of GridCaptionSummaryCell and GridIndentCell.

 

Refer to the following code for writing style for summary cells to show the vertical border.

<Style TargetType="syncfusion:GridCell">
    <Setter Property="BorderThickness" Value="0"/>
</Style>
<Style TargetType="syncfusion:GridIndentCell">
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type syncfusion:GridIndentCell}">
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
<Style TargetType="syncfusion:GridCaptionSummaryCell">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type syncfusion:GridCaptionSummaryCell}">
                <Border x:Name="PART_GridCaptionSummaryCellBorder"
                    BorderThickness="0"
                    SnapsToDevicePixels="True">
                    <ContentPresenter Margin="{TemplateBinding Padding}"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                  SnapsToDevicePixels="True" />
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

 

SfDataGrid_GridLine

View sample in GitHub

Reference links:

https://help.syncfusion.com/wpf/datagrid/styles-and-templates

https://help.syncfusion.com/wpf/datagrid/conditional-styling

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile