How to navigate from Child Window to MainPage in SL5 RRS feed

  • Question

  • How to navigate from Child Window to MainPage in SL5

    where child window is Login window & mainpage is Home page.

    Thanks in advance.

    Saturday, January 9, 2016 9:36 AM


  • I would make the login window a child of mainpage.

    I usually have a single page app with mainpage hosting usercontrols instead of navigating to other controls.

    Mainpage looks something like:

      menu of some sort
     <ContentControl Name="MainPanel"/>

    To navigate, I set the content of MainPanel to the page the user is navigating to.

    I use mvvm light messenger to message from viewmodel to MainPage code behind to drive that process.

    A snippet from one of my mainpages:

        public partial class MainPage : UserControl
            public MainPage()
                Messenger.Default.Register<NavigatePage>(this, (action) => ReceiveNavigateMessage(action));
                Messenger.Default.Register<CommandDone>(this, (action) => ReceiveCommandDoneMessage(action));
                Messenger.Default.Register<Admin>(this, (action) => ReceiveAdminMessage(action));
            private object ReceiveNavigateMessage(NavigatePage navigatePage)
                this.MainPanel.Content = navigatePage.Page;
                return null;

    Hope that helps.

    Technet articles: WPF: Layout Lab; All my Technet Articles

    • Proposed as answer by Weiwei Cai Monday, January 11, 2016 1:04 AM
    • Marked as answer by Weiwei Cai Monday, January 18, 2016 6:59 AM
    Saturday, January 9, 2016 10:10 AM