Articles in this section
Category / Section

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

1 min read

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

 

Conclusion

I hope you enjoyed learning about how to remove the gridline of WPF DataGrid (SfDataGrid) with grouping.


You can refer to our WPF DataGrid feature tour
page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF DataGrid example
to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial
to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied