初始化组件后的调用方法

时间:2018-12-27 13:09:49

标签: c# xamarin mvvm xamarin.forms

我有一个遵循MVVM模式的Xamarin Forms应用程序,我想在Main Page构造函数上调用一个Splash Page,我有Navigation Command,只是不知道如何调用它。

MainPage.xaml.cs

public MainPage()
        {
            InitializeComponent();
            BindingContext = new ViewModel.MainPageViewModel();
            //here I would like to Call the SplashCommand
        }

MainPageViewModel.cs

public MainPageViewModel()
        {

            this.SplashCommand = new Command(this.MethodThatNavigatesToSplashPage);
            this._navigationService = DependencyService.Get<Service.INavigationService>();
        }

0 个答案:

没有答案