Articles in this section
Category / Section

How to edit a column in Xamarin.iOS DataGrid?

1 min read

Currently Xamarin.iOS DataGrid 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




I hope you enjoyed learning about how edit a column in Xamarin.iOS DataGrid.

You can refer to our Xamarin.iOS DataGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Xamarin.iOS DataGrid  example
to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!






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