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. (Last updated on : Nov 16th 2018).
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?

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.

C#

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.

XAML

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

C#

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

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework: Product Version:
2604 09/10/2014 06/05/2015 WPF SfDataGrid 4.5 12.1.0.43
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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