Hi,
You can call the column.GetFittedWidth() once the Grid is loaded. So the DataGridControl_Loaded handler is a good place.
But this column.GetFittedWidth() method call will return the fitted width of the columnManagerCell, not its content.
If you want to have the widest visible value for a column, you must use a Dispatcher to call GetFittedWidth() in the Loaded event :
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF
You can call the column.GetFittedWidth() once the Grid is loaded. So the DataGridControl_Loaded handler is a good place.
But this column.GetFittedWidth() method call will return the fitted width of the columnManagerCell, not its content.
If you want to have the widest visible value for a column, you must use a Dispatcher to call GetFittedWidth() in the Loaded event :
private void DataGridControl_Loaded( object sender, RoutedEventArgs e )
{
var grid = sender as DataGridControl;
this.Dispatcher.Invoke( DispatcherPriority.ApplicationIdle, new Action( delegate ()
{
foreach( Column column in grid.Columns )
{
double width = column.GetFittedWidth();
if( width > 0 )
column.Width = width;
}
} ) );
}――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF