)
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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create a custom GridColumn ?

Platform: Xamarin.Forms |
Control: SfDataGrid |
Published Date: October 16, 2018 |
Last Revised Date: October 16, 2018
Tags: gridcolumn

SfDataGrid allows you to create custom GridColumn by following the below steps.

  1. Create a new class by inheriting from the GridColumn. You must specify the GridColumn.CellType property to create a custom column.
  2. A corresponding CellRenderer class for the custom column must be created by customizing the GridVirtualizingCellRenderer<D, E>.
  3. You should override the below methods in the created cell renderer class.
  1. OnCreateDisplayUIView()to create the cell content to be loaded inside the grid cell.
  2. OnInitializeDisplayView() – to initialize the cell content loaded inside the grid cell with required settings.
  1. Finally, you must add the custom column to the SfDataGrid.Columns collection and its renderer in the SfDataGrid.CellRenderers collection.

Note:

D- type of the view that should be placed inside cells in display mode

E- type of the view that should be placed inside cells in edit mode

 

For example, refer the below example in which a custom column is created for loading a Stepper control in the grid columns. Since the Stepper control is loaded the LoadUIView property is set as true. A custom renderer class is written to load Stepper control as both display and edit views.

Creating Stepper Column

 

Custom cell renderer for StepperColumn

 

MainPage

 

Screenshot

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

SampleLink: How to create a custom GridColumn?

 

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
ADD COMMENT
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
Live Chat Icon