Hey Folks, i have an app where i have a PageControl with 3 tabs. Every tab has a topic. There are multiple pages for one topic.
I already succeeded in navigating between different topics. sample code first:
<PageControl ux:Name="pages" Active="firstTopic" > <Page ux:Name="firstTopic" /> <Navigator ux:Name="secondTopic" DefaultPath="secondTopicFirstPage" > <Page ux:Name="secondTopicFirstPage" /> <Page ux:Name="secondTopicSecondPage" /> </Navigator> <Navigator ux:Name="thirdTopic" DefaultPath="thirdTopicFirstPage" > <Page ux:Name="thirdTopicFirstPage" /> <Page ux:Name="thirdTopicSecondPage" /> </Navigator> </PageControl>
Now what i want to achieve:
secondTopicFirstPage is a List with items fetched from a database and the
secondTopicSecondPage is a page to add new items to the database. When i’m saving the item i pop out a decision modal whether the user wants to add another item or continue in the workflow of the app. If he chooses the second option he gets navigated to
thirdTopicSecondPage with the newly created item as Parameter.
This works with:
Router.goto("pages" , null, "thirdTopic", null, "thirdTopicSecondPage", item);.
When the user now swaps the PageControl back to the secondTopic he still sees the ItemAddPage -->
A workaround is to first tell the Router to go to the
secondTopicFirstPage so i see the first page in the second tab and immediately call the second router function like this:
Router.goto("pages", null, "secondTopic", null, "secondTopicFirstPage", null); Router.goto("pages", null, "thirdTopic", null, "thirdTopicSecondPage", item);
But this looks kinda bad in my eyes and even make some problems with the transition animations.
What i thought to achieve is, to let the navigator set his active page to the first one everytime it gets “activated”. So if i swap to a secondPage from one Topic, swap the tab in my PageControl and then return to the original tab i want to see the firstPage of this topic.
A second question: Maybe the system we’re using is totally wrong for what we want to achieve?