Suppose there are three columns in the XamDataGrid: Year, Location and Donkey. At the moment, when I pull up the header from any of these to the upper part, I get the grouping done automagically, which is great. When I pull up a second header, the gouping gets nested, which is even more great.
However, since the nesting is so clearly specified, I feel that there's no need to list the values of the column that is used for grouping - after all, it only contains one and the same value on all the lines. That's unnecessary.
How can I format my XAML (or what methods do I need to override) to only get the donkeys, if the grouping by year and location is active?
You can set the CellVisibilityWhenGrouped on the Settings of the fields for which you want to do that. e.g.
<igWpf:XamDataGrid BindToSampleData="True"> <igWpf:XamDataGrid.FieldLayouts> <igWpf:FieldLayout> <igWpf:Field Name="name"> <igWpf:Field.Settings> <igWpf:FieldSettings CellVisibilityWhenGrouped="Collapsed" /> </igWpf:Field.Settings> </igWpf:Field> </igWpf:FieldLayout> </igWpf:XamDataGrid.FieldLayouts></igWpf:XamDataGrid>
It seems to work for a single column, so the issue can be said to be resolved. However, I noticed that when I putCollapseon one column andHiddenon another one, the latter seems to be unaffected. Putting both onCollapseyielded the expected result, though. Not sure if it's a bug or just intended, if not intuitively expected, feature.
That property uses the Visibility enumeration defined by the framework which is why Hidden is there but Hidden doesn't really have any meaning in this case so the behavior your describing is expected. The property probably should have been a Boolean or different enumeration but that cannot be changed at this point.
I understand (and it's along the lines of what I expected). However, I'd claim that - contrary to your statement - the enumerationis in fact correct. Perhaps unintentionally but still... If you think about it, that's precisely the three modes that a column ought to have - unaffected by the grouping, collapsed to be removed from the viewand- drumroll here - still occupying the same width on the display but with empty cells.
I can imagine that'd be useful on occasion, especially if the affected column is placed at a clever position in the table. So my suggestion would be to accept the mistake and follow it through by adding the functionality.
In looking at it closer we do honor the Visibility of the Field being set to Hidden so we should be able to handle this on the CellVisibilityWhenGrouped so it might just be a caching issue as it does seem to update if that property is changed after the grouping operation occurs.