public override void Show(MvxViewModelRequest request) { var viewModelLoader = Mvx.Resolve <IMvxViewModelLoader>(); var viewModel = viewModelLoader.LoadViewModel(request, null); if (request.ViewModelType == typeof(FormsViewModel)) { var page = new TestPage { BindingContext = viewModel }; var viewController = page.CreateViewController(); MasterNavigationController.PushViewController(viewController, true); return; } if (request.ViewModelType == typeof(FormsTabViewModel)) { var page = new TabPage() { BindingContext = viewModel }; var viewController = page.CreateViewController(); var attribute = new MvxTabPresentationAttribute() { TabName = page.Title }; TabBarViewController.ShowTabView(viewController, attribute); return; } base.Show(request); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Do any additional setup after loading the view. // Initialize Xamarin.Forms framework global::Xamarin.Forms.Forms.Init(); // Create an instance of XF page with associated View Model var xfPage = new TestPage(); //var viewModel = (MainPageViewModel)xfPage.BindingContext; //viewModel.Message = "Welcome to XF Page created from an iOS Extension"; // Override the behavior to complete the execution of the Extension when a user press the button //viewModel.DoCommand = new Command(() => DoneClicked(this)); // Convert XF page to a native UIViewController which can be consumed by the iOS Extension var newController = xfPage.CreateViewController(); // Present new view controller as a regular view controller this.PresentModalViewController(newController, false); }