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 disable Edit mode for cells in SfDataGrid with different background for those disabled cells?

Platform: WPF |
Control: SfDataGrid |
.NET Framework: 4.5 |
Product Version:

In SfDataGrid, you can disable editing for particular columns by setting the AllowEditing property to False. Also you can disable editing for particular cells by handling the CurrentCellBeginEdit event.

In the CurrentCellBeginEdit event, you can cancel the Edit mode for certain cells by setting the Cancel property to True. In the following code, the Edit mode is disabled for the cells if the value is null.


The following example has disabled Edit mode for cells using the CurrentCellBeginEdit event. For differentiating the Edit mode disabled cells, you can set separate background color for those cells by customizing styles for GridCell. Here, you can change the background property of the GridCell based on value, using CellBackgroundConverter.

Refer the following code snippet to apply GridCell Style.


Here, if the value of the cell is null, it means you have applied the background color Gray. The following code snippet for CellBackgroundConverter.


The following screenshot displays the difference between the Normal and Edit mode disabled cells.


You can refer to the following samples to display the edit mode for cells in SfDataGrid with different background for the disabled cells.

WPF: DisableEditmode_WPF

WRT: DisableEditmode_Winrt

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
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