wpf grid sort data

Discussion in 'Programming' started by alexandarx5, May 12, 2016.

  1. alexandarx5

    alexandarx5 New Member

    Joined:
    May 12, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    how can a programmer using dapfor wpf gridcontrol to sort data by column used for grouping.
     
  2. lifeguru02

    lifeguru02 New Member

    Joined:
    May 12, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Here is how you can do it.
    C#
    Header header = grid.Headers[0];
    Column column1 = header["Column1"];
    Column column2 = header["Column2"];

    //Sort by the first column
    column1.SortDirection = SortDirection.Ascending;

    //Turn on the multiple sort by the second column
    column2.SortDirection = SortDirection.Descending;

    //Enumerate all sorted columns
    foreach (Column column in header.SortedColumns)
    {
    //Some code here...
    }

    //Clear the sort
    header.SortedColumns.Clear();
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice