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
210
Changing tabs, load form everytime
posted

I am using xamDockManager in my application. I placed user control on each tab. the problem is that, every time I switch between tabs, it call UserControl_Loaded method, this will load my screen again and again. and call the dataload method again and again, which \kills the performance.

To resolve this, I place a boolean variable and on first load, I make it true and other time, if found true, return from the method.

If some one has some better way to handle it, using some property or other, it is highly appreciated.

 

Regards

Muhammad Sharjeel Ahsan

Parents
  • 54937
    Verified Answer
    Offline posted

    The TabGroupPane is a TabControl. When you change tabs in a tab control the content comes out of the visual tree and its Unloaded event gets invoked and its Loaded event is reinvoked when it reenters the tree. If you want to avoid performing your initialization code multiple times you could use a flag as you have or you could unhook the loaded event in the loaded event handler.

Reply Children
No Data