I would like to have the last column fill in the (use up) the remaining space in the grid.
Hello,
For this, you can use the DataRecordCellAreaGridTemplate property of the XamDataGrid. Here is a simple code snippet for achieving this
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings>
<igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
</igDP:FieldLayoutSettings>
</igDP:XamDataGrid.FieldLayoutSettings>
What if I want to do this at run time. Specifically what is this <ColumnDefinition Width="*"/> in code?
Try something like this:
ColumnDefinition col = new ColumnDefinition();
col.Width = new GridLength(1, GridUnitType.Star);
So assuming I want to do this to the last visible column and this is in generic code (hence no xaml) and I don't know howmany columns or anything like that. I catch FieldLayoutInitialized and manipulate the layout to match the information i want to display such as which columns in the object etc. I just want the last column to fill all of the space left in the window whatever that happens to be.
So I am hoping there is some kind of thing like
field.settings.collumndeffinition = (your code) or
grid.array[field.index] = (your code)
Thanks
I have a follow on question which is assuming that I have objects which contain objects so that say the root object has 2 columns and the one kind of child object has 3 how do I get the second column in the root and the fifth on the child?