DataGrid.ColulmnWidth issue

Dec 11, 2008 at 8:56 AM
Hi, all

if I set ColumnWidth to the DataGrid when it loads, that works.

but when I using a bing below:

 

<ComboBox Grid.Row="1" SelectedItem="{Binding Path=ColumnWidth, ElementName=dataGrid}">

<toolkit:DataGridLength>SizeToHeader</toolkit:DataGridLength>

<toolkit:DataGridLength>Auto</toolkit:DataGridLength>

<toolkit:DataGridLength>SizeToCells</toolkit:DataGridLength>

<sys:Int32>100</sys:Int32>

</ComboBox>

then I select different item in the comboBox, I find that each column's width doesn't change,
why?

Thanks for your help.

Coordinator
Dec 18, 2008 at 8:28 PM
This is actually a limitation of the DataGrid framework where column width values are set locally after initialization.  So setting DataGrid.ColumnWidth will only work on initialization of the DataGrid.