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 update when not visible
posted

Hi,

i have multiple xamGrids in multiple tabs of a tabcontrol.

i am updating the itemssource  and hiding some columns.

my problems is that the columns are not hidden except for the active grid.

as for the itemssource, i want to update it multiple times. so i check if it is null, i initialize it, else i add to it.

the problem is that within the loop it's always returning null.

i tried onApplyTemplate(), InvalidateData(), UpdateLayout() but it's not working

any ideas?

 

  • 40030
    Verified Answer
    Offline posted

    Hi, 

    If you're trying to modify AutoGenerated columns, they are only created once the xamGrid loads it's itemsSource which doesn't happen until it's loaded. 

    In a TabControl situation, any grid on an unselected tab will not be in the visual tree, and thus not loaded, so it's itemsSource won't be applied and thus no columns. 

    You should only apply changes to the xamGrid that is currently visible. 

    You can listen to the xamGrid's loaded event to know when columns will be set. 

    -SteveZ

  • 5520
    posted

    any suggestions?