Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
635
Difference between grouping via drag-drop vs programmatically
posted

Hello,

I'm seeing a difference in behavior and I was hoping someone could help me out. If I drag a column into the group area and then drag it out, the column re-appears in its original location.

If I instead programatically group that same column doing this:

Grid.DisplayLayout.Bands[0].Columns[itemColumnKey].Hidden = itemHiddenValue;
Grid.DisplayLayout.Bands[0].Columns[itemColumnKey].Header.VisiblePosition = itemPosition;

 Grid.DisplayLayout.Bands[0].SortedColumns.Add(itemColumnKey, true, true);

and then drag it out of the group area, the column disappears completely.

I would like the column to re-appear in its previous location the same as if it were grouped via drag-drop. Any help would be appreciated.

Parents
  • 5118
    posted

    Hi,

    The column will be hidden automatically unless you are overriding this behavior... So all you need to do is

    Grid.DisplayLayout.Bands[0].SortedColumns.Add(myColKey, true, true); to put it into GroupBy.  When you ungroup (through UI or with code by clearing the sorted columns collection or setting the flag to false for group by on that one) it will go back where it started. 

    Attached is the sample I was using while playing with each scenario... drag/drop group by... dynamic ungroup and so on...

    WinGridGrouping.zip
Reply Children