Cetin,
I had not set the MappingName, but it still did not work even after I set the MappingName property for each item in the DataGridColumnStyle collection through the designer.
Using the code in your example I now see that I have the MappingName but the Width stays the same even if I adjust the column width at run time.
Are you using the designer or are you doing things through code?
Einar
>Einar,
>You set the width properties but did you also set MappingName ? Probably that style is not used at all. If in use you should get the widths as you resize:
>
>
>foreach(DataGridColumnStyle dcs in dataGrid1.TableStyles[0].GridColumnStyles)
>{
> MessageBox.Show( String.Format (
> "Column header:{0}\nColumn source:{1}\nColumn width:{2}",
> dcs.HeaderText,dcs.MappingName,dcs.Width));
>}
>
>Check if mappingname (Column Source) is empty or not.
>Cetin
Semper ubi sub ubi.