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.
Unfortunately, activation email could not send to your email. Please try again.

How to commit the edited values when binding Dictionary in SfDataGrid?

By default, Dictionary does not notify property changes and hence the edited values will not get committed when bound with a Dictionary in SfDataGrid.

However, this can be achieved in SfDataGrid by customizing the cell renderers. Please follow the below steps.

  1. Customize the GridCellTextViewRenderer and override the CommitCellValue method.
  2. In the CommitCellValue method, obtain the edited value using the GetControlValue method. Then replace the actual value of the bound property with the edited value for the editing cell and update the new values in the grid using UpdateCellValue method.
  3. For refreshing the new cell value in view, call the RefreshDisplayValue method.
  4. Finally, you must modify the cell renderer mapping by replacing the existing TextView entry with the customized cell renderer in the SfDataGrid.CellRenderers collection.

Refer the below code example to commit the edited values in dynamic collection.

MainPage.cs

 

GridCellTextViewRendererExt.cs

 

Screenshot:

C:\Users\pavithra.sivakumar\AppData\Local\Microsoft\Windows\INetCache\Content.Word\Editing cell.png

 

Sample Link: How to commit the edited values when binding Dictionary in SfDataGrid?

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework:
7853 07/14/2017 07/14/2017 Xamarin.Forms SfDataGrid 4.5.1
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.