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

is there any code sample for this GridCellRendererCollection ?

Thread ID:





128880 Feb 14,2017 01:33 AM UTC Feb 14,2017 06:48 AM UTC Xamarin.Forms 1
Tags: SfDataGrid
Kumaraswamy Bala
Asked On February 14, 2017 01:33 AM UTC

Hi, can you please elaborate this GridCellRendererCollection class, how can we use this exact and where can we use ?


Divakar Subramaniam [Syncfusion]
Replied On February 14, 2017 06:48 AM UTC

Hi Kumaraswamy, 
In SfDataGrid, we have maintained separate renderers for separate views in dictionaries (with key and value pair). For example, in GridSwitchColumn, we have loaded SfSwitchControl which is derived from Xamarin.Forms.Switch and we customized the switch view in renderer projects separately where we have loaded native switch controls for Android, iOS and UWP. 
Also, you can customize those renderers by writing your own custom renderer. For that, you have to remove the existing renderer from the GridCellRenderer collection and add your custom renderer. Please refer the below code snippet. 
// In code-behind 
dataGrid.CellRenderers.Add("Switch",new CustomSwitchRenderer()); 
public class CustomSwitchRenderer : GridCellSwitchRenderer 
    public override void OnInitializeDisplayView(DataColumnBase dataColumn, SfSwitchControl view) 
        base.OnInitializeDisplayView(dataColumn, view); 
        view.IsEnabled = false; 
In the above code, we have written a new renderer which is derived from GridCellSwitchRenderer. And then removed the existing switch renderer from the CellRenderers collection and added our own renderer. 
We have prepared a simple sample for your reference and you can download the same from the below link. 
Please refer the below KB link. In the KB we have written a new renderer HeaderCell in Xamarin.iOS platform(modify the code based on Xamarin.Forms platform). We have attached this KB for your reference and which will help you to understand better. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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