You used MainPage = new NavigationPage(new MainPlayerPage());
in the App.cs, so you didn't use the AppShell and can't use Shell.Current.GoToAsync(pageName)
to navigate in the NavigationPage
.
You can set the MainPage as AppShell( MainPage = new AppShell();
) in the App.cs and then please use the RelayCommand attribute instead of the IAsyncRelayCommand
. Such as:
namespace MySolution.Client.Core.ViewModels{ public partial class MainPlayerViewModel : ObservableObject { [ObservableProperty] private String _identifier = "Just to make sure the BindingContext is set properly..."; private readonly INavigationService navigationService; public MainPlayerViewModel(INavigationService navigationService) { this.navigationService = navigationService; } [RelayCommand] private Task NavigateToEditPage() => navigationService.GoToEdit(); [RelayCommand] private Task ChangeSecondLabelText() { Identifier = "And now we change the text of the second label..."; return Task.CompletedTask; } }}