OK, I'm having a heck of a time trying to find the magic incantations to make columns automatically size to their content.
Suppose I have three columns: "Size", "Mean" and "Sample Standard Deviation". I would like the Size and Mean columns to squeeze down to some minimum width, say 75 WPF pixels. But I would like the third column to expand to show the full text of the label.
"Autofit"only seems to make all columns the same width, which is not what I want.
As a bonus, I would also like to have each column automatically size to its data, so that if I entered "9999999999" in the size column, then the whole column would automatically grow larger to accommodate the new number.
Thanks,
Denny Huber
In order to do this you also have to specify a template for the grid that will be used to layout the cells in each record, as in the sample xaml below.
Note: The reason we had to take this approach instead of hanging properties off the Field is because in more complex cell layout scenarios, e.g. where cells span mutiple row/columns within each record there is not a one for one correspondence between the Field and the column(s) that contain it within the cell area of a record.
<igDP:FieldLayoutSettings>
<igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
</igDP:FieldLayoutSettings>
</igDP:XamDataPresenter.FieldLayoutSettings>
So far so good, but this makes a *very* common scenario rather complex, and if I got that right, it disallows the user to resize the column widths. My current project contains roughly 10 different grids and I'm missing a working resizing behaviour in every one of them, mainly because I want to fill the columns all available space (AutoFit is a joke, I really can't image I'll ever need equally sized columns in a real live application that provides heterogenous data). IMO there is no valid explanation why this shouldn't work like WinGrid - if AutoFit AND cell widths would work together, we had a simple solution.
Just my 0.02$