Answers for "Navigate Handled in viewModel Xamarin"

0

Navigate Handled in viewModel Xamarin

namespace YourApp.ViewModels
{
    public class CurrentPageViewModel
    {
        public ICommand BackToPage  {get; private set; }

        public CurrentPageViewModel()
        {
            BackToPage = new Command(async () => {
              await  Application.Current.MainPage.Navigation.PushModalAsync(new MainPage());
            });
        }
    }
}
Posted by: Guest on July-26-2020
0

Navigate Handled in viewModel Xamarin

namespace RealmApp1.Views
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
            BindingContext = new MainPageViewModel();
        }      
    }
}
Posted by: Guest on July-26-2020
0

Navigate Handled in viewModel Xamarin

namespace YourApp.ViewModels
{
    public class MainPageViewModel 
    {
        public ICommand BackToMain { get; private set; }

        public MainPageViewModel()
        {
            BackToMain = new Command(async () => {
                await Application.Current.MainPage.Navigation.PopAsync();
            });
        }
    }
}
Posted by: Guest on July-26-2020

Browse Popular Code Answers by Language