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 edit a column in SfDataGrid?

Platform: Xamarin.iOS |
Control: SfDataGrid
Tags: editing

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 custom GridCell derived from GridCell. You can load an editable control inside the GridCell from the sample. The edited values can be committed in the EditingChanged event handler of the UITextField class.

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


public partial class ViewController : UIViewController


   public ViewController()



   SfDataGrid grid = new SfDataGrid();

   ViewModel viewmodel = new ViewModel();               

   public override void ViewDidLoad()



      this.View.BackgroundColor = UIColor.White;

      grid.ItemsSource = viewmodel.Info;

      //Creation of a template column

      var textcolumn1 = new GridTextColumn


         MappingName = "Name",

         UserCellType = typeof(CustomCell), //Adding a custom cell into the template column

         HeaderText = "Name"





   public override void ViewDidLayoutSubviews()


      this.grid.Frame = new CGRect(0, 20, View.Frame.Width, View.Frame.Height - 20);






public class CustomCell:GridCell


   private UITextField edit;

   public CustomCell ()


      edit = new UITextField ();

      edit.AllowsEditingTextAttributes = true;

      edit.EditingChanged += Edit_EditingChanged;

      this.edit.ShouldReturn += (textField) =>



         return true;




   public override void WillMoveToWindow(UIWindow window)


                List<UIGestureRecognizer> gesturelist;

                if (this.GestureRecognizers != null)


                                gesturelist = new List<UIGestureRecognizer>();

                                foreach (var gesture in this.GestureRecognizers)


                                gesturelist.FirstOrDefault(ges=> ges is UITapGestureRecognizer).ShouldRecognizeSimultaneously = (gestureRecognizer, otherGestureRecognizer) => true;




   public void Edit_EditingChanged (object sender, EventArgs e)


      var edited = this.DataColumn.Renderer.DataGrid.View.GetItemProperties ();

      edited.SetValue (this.DataColumn.RowData,


                                  this.DataColumn.GridColumn.MappingName );


   public override void LayoutSubviews ()


      edit.Frame = new CGRect(0,0,this.Frame.Width,this.Frame.Height);               

      edit.Text = Convert.ToString(DataColumn.CellValue);

      base.LayoutSubviews ();


   protected override void UnLoad()






The following screenshot shows the final outcome upon execution of the above code.

The working sample for this KB is available in the following location









2X faster development

The ultimate Xamarin 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