Articles in this section
Category / Section

How to edit a column in SfDataGrid?

1 min read

Currently SfDataGrid does not directly support editing of GridCells. However if your requirement is to edit the text of the GridCells during runtime, SfDataGrid allows you to achieve this by creating a TemplateColumn and loading an Entry cell into it using the DataTemplate property. The edited values are automatically committed since Entry cell has a default two way binding.

Refer the following code example to edit the text of GridCell in runtime.

<?xml version="1.0" encoding="utf-8" ?>

<ContentPage xmlns=""




             xmlns:local ="clr-namespace:Edit;assembly=Edit">



   <local:ViewModel x:Name="viewModel" />



  <sfgrid:SfDataGrid x:Name="dataGrid"


                     ItemsSource="{Binding Info}">


   <sfgrid:SfDataGrid.Columns x:TypeArguments="sfgrid:Columns">


     <sfgrid:GridTextColumn MappingName="ID"/>


     //Creation of template column

     <sfgrid:GridTemplateColumn MappingName="Name">



           <Entry x:Name="label" Text="{Binding Name}" TextColor="Black"

                   HorizontalOptions="Center" VerticalOptions="Center" />





   <sfgrid:GridTextColumn MappingName="Percentage"/>

     <sfgrid:GridTextColumn MappingName="Result"/>

     <sfgrid:GridTextColumn MappingName="Remarks"/>






The following screenshots shows the final outcome when the above code is executed.

You can download the working sample for this KB from the below link.

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