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
5520
Grid ItemsSource differ from visible columns
posted

Hi, 

i have an xamGrid in which i am assigning itemsSource to a customized datatable class that we created (contains columns, rows, dataview ...)

in my case the grid columns are dynamic. i can add and remove columns

when i change the itemsSource, i save the layout of the Grid using the persistence manager then i reload it when i change the itemsSource.

the added columns appear for a second then disappear when i reload the layout.

when i debug i find that the grid contains 3 columns while the itemsSource contains 5 items.

i thought i had a solution by saving each column's layout and reload it. but the layout is not reload it well (sorting, conditional formatting ...) while when saving the grid's layout, the layout is loaded but the columns are disappearing 

please advise

Parents Reply
  • 5520
    posted in reply to Stephen Zaharuk

     

    hi, 

    i tried a new sample that works like this:

    i have 2 classes: 

    testData have properties: Key,Col1,Col2

    testData1 class have properties: Key,Col1,Col2,Col3

     

    i made a list of testData give it to the xamGrid as ItemsSource

    Save Layout

    Change itemsSource to a list of testData1

    Reload layout

    by doing that Col3 will disappear.

    i tried changing the name of the properties in testdata1 and found that the properties that do not exist in testdata will disappear.

    is there a way to avoid this? like keeping the new columns?

    regards

Children