views:

146

answers:

2

We are using tab control in our project. While using this control i came across a few issues like - When the tab control loads, it invokes constructor of all the xaml pages that form the individual tabs. Can this be avoided?

  • Is there any event with tab control that we can use to identify dirty data on the previous tab that i may have visited. I mean can i prevent user from navigating to some other tab before saving the changes on current tab.
A: 

You should be able to avoid the instantiation of each xaml page in the individual tabs by adding the content to the tabs dynamically, right before they are shown for the first time. You might be able to get away with doing this on the tab control's SelectionChanged event.

The tab control does not have a dirty state management. At best, you individual containers/pages will have to handle the dirty state.

Jeff Schumacher
A: 

I mean can i prevent user from navigating to some other tab before saving the changes on current tab.

I don't think you can prevent it. We have something similar in our app and the route we have chosen is if the page is validated then the Tabs becomes enabled so they can either click save or navigate to a different tab. In case they navigate to a different tab without clicking on save we will perform save for them. I think as a user perspective this is a good thing!

VoodooChild