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
896
Programatically doing GroupBy on invisible columns
posted

Hi

I have a set of columns which would be invisible, and i want to group the rows in the grid based on these columns. Is it possible, if so a small piece of sample code would definitely help ; )

Thanks in advance

Abhi

  • 69686
    Verified Answer
    posted

    Hello Abhi,

    You can use the following code snippet for that.

    ...

      xamDataGrid1.FieldLayouts[0].Fields[0].Visibility = Visibility.Hidden; // hidden field

    ...

    private void button1_Click(object sender, RoutedEventArgs e)

            {

                xamDataGrid1.FieldLayouts[0].SortedFields.Add(new FieldSortDescription(xamDataGrid1.FieldLayouts[0].Fields[0].Name, System.ComponentModel.ListSortDirection.Ascending, true));

            }

    Let me know if you have questions with this matter.

    Alex.