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

How to autosize column widths in SfDataGrid?

Thread ID:





118961 Apr 28,2015 04:11 PM UTC Apr 30,2015 07:26 AM UTC Xamarin.Android 3
Tags: General
Asked On April 28, 2015 04:11 PM UTC

I am trying to autosize column widths in the new SfDataGrid for Xamarin.Android (Preview), but I can't find the right option. Now my columns are fixed width and behave differently on small & large screen resolutions.

Is column autosizing not implemented yet or is there a workaround?

Regards, Michel.

Harikrishnan N [Syncfusion]
Replied On April 29, 2015 12:05 PM UTC

Hi Michel,

Sorry for the inconvenience caused

At present there is no support for “Column AutoSizing”. However you can set the default column width by using the SfDataGrid.DefaultColumnWidth property or you can set the individual column’s width by handling the SfDataGrid.AutoGeneratingColumn event and by setting the Column.Width property of each column to meet your requirement. Please refer the below code snippet.

//Setting the Column width of all the columns

sfGrid.DefaultColumnWidth = 180;

sfGrid.AutoGeneratingColumn += GridAutoGenerateColumns;

void GridAutoGenerateColumns (object sender, AutoGeneratingColumnArgs e)


if (e.Column.MappingName == "SupplierID") {

e.Column.Width = 150;


/// more code for other columns

We have this Feature in our wish list and it will be implement in our upcoming release.

Please let us know if you have any further queries.


Replied On April 29, 2015 12:18 PM UTC

Thanks for your reply Harikrishnan.

I have come up with the following solution for now:

During the column definition I first get the ScreenWidth and ScreenHeight by calling:
    App.ScreenWidth = (int)Resources.DisplayMetrics.WidthPixels; // real pixels
    App.ScreenHeight = (int)Resources.DisplayMetrics.HeightPixels; // real pixels

Then I assign the Width of each column to a percentage of that ScreenWidth.
If the sum adds up to 100% I can be sure that it fits on the screen.

Looking forward to the next release. Is there a public wishlist available?

Regards, Michel.

Harikrishnan N [Syncfusion]
Replied On April 30, 2015 07:26 AM UTC

Hi Michel,

Sorry, There is no public wishlist available.

Please let us know if you have any further queries.



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