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

Resize column width based on cell content

Thread ID:

Created:

Updated:

Platform:

Replies:

144819 May 24,2019 05:55 AM UTC May 27,2019 06:59 AM UTC WPF 1
loading
Tags: GridControl
Vishnu Babu
Asked On May 24, 2019 05:55 AM UTC

Hi,
I am migrating syncfusion winforms GridControl to wpf GridControl. In winforms GridControl, auto resizing of columns based on cell content is achieved using "gridControl.ColWidths.ResizeToFit()" function, but i couldn't find any similar kind of function in syncfusion wpf GridControl (ver 16.3.0.21). Please let me how to implement the same.

Thanks in advance
Vishnu

Jagadeesan Pichaimuthu [Syncfusion]
Replied On May 27, 2019 06:59 AM UTC

Hi Vishnu, 
  
Thanks for using Syncfusion product. 
  
To fit the column based on the content, you could use the ColumnSizer property in GridControl.Loaded event. Please refer the following code example. 
  
C# 
this.grid.Loaded += Grid_Loaded; 
private void Grid_Loaded(object sender, RoutedEventArgs e) 
{ 
    grid.Model.Options.ColumnSizer = GridControlLengthUnitType.Auto; 
} 
  
Please refer the following forum link, 
  
To fit the column width based on the window size, please refer the following KB link, 
  
Please get back to us if you need any further assistance on this. 
  
Regards, 
Jagadeesan 


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