Search code examples
uno-platform

Convenient way to navigate throught views on uno-platform


I am very new to UnoPlatform. I am trying to create a new application. Yet for some time I am stuck at creating convenient way to navigate through views.

I searched through webs and forums. I found that the best design pattern would be MVVM. Demo Apps on platform.uno seems to be implemented using this pattern as well. However some approaches i found online are not possible with unoplatform, as far as I understand it.

To give an example: The app starts at LoginPage. On successful login I want to be taken to a completely different view with different controls. One of the approaches I found is by holding currently active viewmodel and render pages accordingly.

Is there some approach you would recommend for navigating through views? Or some material I could read to understand this concept better?


Solution

  • Using MVVM Light, the navigation needs to be performed using the NavigationService, as you'll find in this documentation: http://www.mvvmlight.net/doc/nav5.cshtml.

    You can also use Prism for Uno, which handles navigation per regions. You can find documentation here https://prismlibrary.com/docs/ and samples here: https://github.com/PrismLibrary/Prism/blob/c71957ad56c0cfedf479d46dcb1870c96232d86c/e2e/Uno/HelloUnoWorld.Shared/ViewModels/ShellViewModel.cs#L30