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
444
XamTabControl - TabItemEx selection unloads control
posted

Hi

I have a XamTabControl with some TabItemEx items, each TabItemEx has a single different User control on it.

When I select a Tab it creates the User control, the Issue is when I select another a different Tab is it unloads the last User Control.

The real problem is that creating the user control is very expensive so I would like my User Control to remain created once it has be visuallised.

I did read that setting a Name will keep it active (I think this was Dock TabPages), I have set a name but no change.

I commented out all of the code in the User Control (it was a Grid and some heavy graphics) and no change.

Any suggestions ?

thanks

Martin

 

 

Parents
No Data
Reply
  • 54937
    Offline posted

    Actually what you read had to do with xamDockManager and whether it would remove unused SplitPanes/TabGroupPanes. This doesn't relate to xamTabControl. xamtabControl is a derived TabControl. When you change selected tabs in the TabControl, only the content of the selected tab is in the visual tree so as you select different tabs, the wpf framework raises the Unloaded event. This is not something that we control. Assuming that the content of the Tab is your usercontrol then the usercontrol isn't getting recreated. Its just that it wil be unloaded and you will get a loaded again when its brought into view. Maybe you just need to track that you have already initialized the usercontrol and not process the loaded again.

Children