NavigateToViewModel with Caliburn Micro 2 and Windows Phone 8.1

I'm trying to figure out how to successfully get Caliburn Micro to move from one page to another in a Windows Phone 8.1 application.

My first page loads just fine, as stated in my App class:

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
    this.DisplayRootViewFor<HomeViewModel>();
}

This launches HomeView without any problems. In this view, I have a button that calls the following method:

public void GoToPage2()
{
    this.navigationService.NavigateToViewModel<Page2ViewModel>();
}

This method is called when the button is clicked and the constructor for Page2ViewModel is called. The page is never displayed, and I cannot understand why. I feel that I am lacking in the basic concept, but I cannot find examples of how this should work.

Thanks for any help.

+4
source share
1

, , Caliburn Micro. OnLaunched :

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
    this.DisplayRootViewFor<HomeViewModel>();
}

, . , , :

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
    this.DisplayRootView<HomeView>();
}

, ! , , , , .

+5

Source: https://habr.com/ru/post/1548714/


All Articles