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
490
Saving column visibility and which rows are expanded
posted

We are using a xamDataGrid (v12.2) where the user can show or hide specific columns (toggles the visibility). We are binding to a hierarchical observable collection so a user also has the ability to expand or collapse a variety of rows.

When we rebind to our data source we need to save the layout of the grid and then load it after we bind to the new data source so that the grid appears the same with possibly some different data. For example, the column visibility as well as which rows are expanded or collapsed will need to be unchanged after rebinding to the new data source. We will also want to save the grid layout per user so that a given user can save their personal grid customizations. What would be the best way to accomplish this?

Thanks

Parents
  • 28407
    Verified Answer
    posted

    HI,

     You can use the the XamDataGrid's Load and SaveCustomizations method to save the layout changes made by the user. It will not save row expansion information.

     You could keep track of that information by sotring on the datasource the XamDataGrid is bound to, or storing it in another collection writing this collection out to disk and reloading it. I am attaching a sample that saves the expansion information in the collection the grid is bound to.

     Sincerely,
     Matt
     Developer Support Engineeer

    WpfApplication9.zip
Reply Children
No Data