As i post in the header, how to do this in code?
the best would be, the width depends on the lengh of the text of column,.
Thanks!!
You could either iterate through the Fields in the layout and set the Width or set it directly in the FieldSettings:
//First way
foreach (Field f in xdg1.DefaultFieldLayout.Fields)
{
f.Width = FieldLength.InitialAuto;
}
//Second way
xdg1.FieldSettings.Width = FieldLength.InitialAuto;
Let me know if you have any questions with this matter.
Thanks, but how can i set this, when the Grid is generate automatically (AutoGenerateFields)
In the XAML code are no Fields defined.
You could set the Field's Width to Auto. For more details check out the online documentation here:
http://help.infragistics.com/NetAdvantage/WPF/2010.3/CLR4.0/?page=xamDataPresenter_Set_a_Fields_Width.html
Let me know if this is what you are looking for.