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
840
WPF xamDataGrid: how to persist grouping?
posted

We have a xamDataGrid that we want to allow the user to expand or collapse any of the groupings... Some expanded and some collapsed... We need help retrieving the currently grouped data so that we can reload the grid at a later time to the exact grouping state. We assume that if the data set has changed and some groups may no longer appear, but what can loaded from the previously persisted state needs to be loaded.

  • 29105
    Verified Answer
    Offline posted

    Hello Jesse,

    Thank you for reaching out. You can save and load group-by settings by performing Save and Load customizations feature on the XamDataGrid.

    eg. http://blogs.infragistics.com/wpf/codesamples/save-and-load-customizations-in-the-xamdatagrid.aspx

    using System.IO; 
    ... 
    using (FileStream fs = new FileStream("xamDataGridLayout1.xml", FileMode.Create, FileAccess.Write)) 

        this.xamDataGrid1.SaveCustomizations(fs); 
    }

    ... 
    //Load the layout from a stream 
    using(FileStream fs = new FileStream("xamDataGridLayout1.xml", FileMode.Open, FileAccess.Read)) 

        this.xamDataGrid1.LoadCustomizations(fs); 

    Please keep in mind that out-of-the-box saving the customizations do not save the expanded state for groupby records. I recommend visiting this forum post for more details on this matter:
    http://es.infragistics.com/community/forums/p/56274/400005.aspx#400005

    Let me know if you have any questions regarding this matter.