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

Determine Aligment, Font, Size in Syncfusion Xamarin Android SfDataGrid As A Programmatically in C#

Thread ID:

Created:

Updated:

Platform:

Replies:

149205 Nov 18,2019 10:16 PM UTC Nov 25,2019 05:04 AM UTC Xamarin.Android 3
loading
Tags: SfDataGrid
Xamarin Hunter
Asked On November 18, 2019 10:16 PM UTC

I've created the different observablecollection inluding different class.
Each binding list model to SfDataGrid, I want to determine each datagrid cell text alignment, cell font size, header text, etc. only programmatically in C# side.
How can I achieve this?

Karthikraja Kalaimani [Syncfusion]
Replied On November 19, 2019 05:22 PM UTC

Hi Xamarin Hunter, 

Thanks for contacting Syncfusion support.

Your requirement can be achieved by using AutoGeneratingColumn event of SfDataGrid. We have prepared sample for the same.

Please follow the below code example, 
  private void SfdataGrid_AutoGeneratingColumn(object sender, AutoGeneratingColumnEventArgs e) 
        { 
            if (e.Column.HeaderText == "OrderID") 
            { 
                e.Column.CellTextSize = 20; 
                e.Column.TextAlignment = GravityFlags.End; 
                e.Column.HeaderText = "Customized OrderID"; 
            } 
        } 

We hope this helps, please let us know if need further assistance from us. 

Regards, 
Karthik Raja 


Xamarin Hunter
Replied On November 24, 2019 03:44 PM UTC

Hi Xamarin Hunter, 

Thanks for contacting Syncfusion support.

Your requirement can be achieved by using AutoGeneratingColumn event of SfDataGrid. We have prepared sample for the same.

Please follow the below code example, 
  private void SfdataGrid_AutoGeneratingColumn(object sender, AutoGeneratingColumnEventArgs e) 
        { 
            if (e.Column.HeaderText == "OrderID") 
            { 
                e.Column.CellTextSize = 20; 
                e.Column.TextAlignment = GravityFlags.End; 
                e.Column.HeaderText = "Customized OrderID"; 
            } 
        } 

We hope this helps, please let us know if need further assistance from us. 

Regards, 
Karthik Raja 


Thanks for exact solution.

Farjana Parveen Ayubb [Syncfusion]
Replied On November 25, 2019 05:04 AM UTC

Hi Xamarin Hunter, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Farjana Parveen A 


CONFIRMATION

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

Live Chat Icon For mobile
Live Chat Icon