Datagrid with Sorted, Grouped collection

    General discussion

  • I have a Sorted, Grouped, Collection bound to the DataGrid.  The rows are sorted by a Sequence number.  If I group the rows, the groups are not in order.  If I click on the Name column header, although the groups become expanded, after collapsing them, I can see that they ARE now in order by Group.

    How can I get the DataGrid to be Grouped in sort order when it loads?

    I tried storing the fact that it was grouped in the IsolatedStorage and changing the Sort Description based on what is in there.  I tried Collapsing both before and after changing the sort description.  But it continues to be not sorted initially.  It only is sorted when I sort the Name column, and then Collapse the rows. (through user action rather than programmatically when loading)

    Thursday, April 26, 2012 4:54 PM

All replies

  • Hi mtiede,

    From what you have mentioned ,I was confused what the problem is.

    Could you clarify the problem you have?

    It would be better to share some codes or a demo that can reproduce this issue.

    Wednesday, May 02, 2012 9:34 PM
  • I have a collection with a GroupDescription.  Like this:

    var conditionConverter := new ConditionPointCategoryNameConverter;
    ConditionGroupItem := new PropertyGroupDescription( 'PointCategoryName', conditionConverter );

    if fObservationPointConditionsIsGrouped then ObservationPointConditionsCollection.GroupDescriptions.Add( ConditionGroupItem ) else ObservationPointConditionsCollection.GroupDescriptions.Remove( ConditionGroupItem );

    The ObservationPointConditionsCollection is bound to the DataGrid.  I would like the grouping variable values to be sorted.  But they aren't.  If I sort a Name column (which isn't the grouping variable) suddenly the groups are sorted.  I would like the grouping variable to be sorted so that the collapsed DataGrid rows show only the groupings AND they are in order. 

    In other words, I want a column that is not the grouping variable to be sorted while at the same time the groupings are sorted (especially when collapsed)

    Thursday, May 03, 2012 8:34 AM