Articles in this section

How to change a particular cell border in WinForms DataGrid (SfDataGrid)?

In WinForms DataGrid (SfDataGrid) you can change the border color and thickness of the particular cells based on some condition by using SfDataGrid.QueryCellStyle event.

 

this.sfDataGrid1.QueryCellStyle += OnSfDataGrid1_QueryCellStyle;
 
private void OnSfDataGrid1_QueryCellStyle(object sender, Syncfusion.WinForms.DataGrid.Events.QueryCellStyleEventArgs e)
{
    if (e.Column.MappingName == "Quantity")
    {
        if ((e.DataRow.RowData as OrderInfo).Quantity < 40)
            e.Style.Borders.All = new Syncfusion.WinForms.DataGrid.Styles.GridBorder(Color.Red, Syncfusion.WinForms.DataGrid.Styles.GridBorderWeight.Thick);
    }
}
 

 

Changed cell border color and thickness for particular cells

Take a moment to peruse the documentation, where you can find about conditional styling in SfDataGrid, with code examples.

Please refer this link to know about the essential features of Syncfusion WPF DataGrid.

You can download the example from GitHub

 

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