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. Image for the cookie policy date

Resize column width based on cell content

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

1 Reply

JP Jagadeesan Pichaimuthu Syncfusion Team 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 


Loader.
Live Chat Icon For mobile
Up arrow icon