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
410
XamGrid Group By - How to programmatically retrieve currently active grouping columns
posted

Hi,

We allow our users to select columns by which to group a grid. We need to save their choice so as to be able to re-instate it later (automatically).

Could you please let me know how to programmatically (C#) retrieve columns by which a XamGrid is currently grouped, and also how to programmatically group that grid by some columns? I would really appreciate if you could provide code samples for both cases.

Thank you.

Best regards,

Adam

Parents
  • 35319
    posted

    Hello Adam,

     

    I have been looking into your questions and you can get the columns by which the XamGrid is currently grouped by getting the ‘GroupByColumns’ collection like e.g. :

     

    List<Column> groupByColumns = this.xamGrid1.GroupBySettings.GroupByColumns.ToList();

     

    You can set the GroupByColumns in code like e.g. :

     

                Column col1 = this.xamGrid1.Columns.DataColumns[0];

                Column col2 = this.xamGrid1.Columns.DataColumns[1];

                this.xamGrid1.GroupBySettings.GroupByColumns.Add(col1); // first approach

                col2.IsGroupBy = true; // second approach

     

    Let me know, if you need any further assistance on this matter.

     

     

Reply Children