Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

problem with navigation

$
0
0

I created a Service (Navigation Service, NavigationService), but when I use in my ViewModel, nothing happens when I use the "PushAsync" but when I use the "PopModalAsync" present my page I want to surf, but I want to use "PushAsync"

My INavigationService
public interface INavigationService
{
Task IrPara(Page page);
}
My NavigationService
public class NavigationService:INavigationService
{
public NavigationService()
{
}
public async System.Threading.Tasks.Task IrPara(Xamarin.Forms.Page page)
{
await Teste.App.Current.MainPage.Navigation.PushAsync(page);
}
}
My ViewModel
public class myViewModel:INotifyPropertyChanged
{

    readonly INavigationService navegar;

    public ICommand testCommand{ get; set;}

    public ObservableCollection<GrupoModel> Grupos{ get; set; }

    public myViewModel()
    {
        testCommand = new Command(this.ActionTeste);
        navegar = DependencyService.Get<INavigationService>();

    }

     public void ActionTeste(){
        navegar.IrPara(new NextPage());
    }

}
My View


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>