I store my page-instances in a stack, pushing and poping the views/pages onto or from the stack. As I said it works fine. What I recognized is that when I pop a page from the stack and set the previous page from the stack as the Border control's child, it seems like all the button's click event handler are unsubscribed: the button-click event is not raised any more, but e.g. the Loaded-event of the page is still raised. Any ideas?
pseudo-code:
Code: Select all
Common:
...
Stack<Pages> TheStack;
Border ContentContainer;
...
Page1:
On Button-Click:
Page page2 = new Page2();
TheStack.Push(page2);
ContentContainer.Child = Page2;
// page2 is displayed
Page2:
On Button-Cancel click:
TheStack.Pop();
Page previousPage = TheStack.Peek();
MyContentProvier.Child=previousPage;
// --> landing on Page1 again, button's Click-event is not raised any more.