Forum Xamarin.iOS

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

SplitView (Master-Details) for iOS-App with Xamarin and MVVMCross 6

I am currently developing an iOS-App with Xamarin and MVVMCross 6 and I would like to create a "SplitView".

The SplitView should consist of a Master and a Details page. In portrait mode only the Master page OR the Details page should be shown.

If the screen of the device is large enough, both pages should be displayed. The Details page should change when an action is performed on the Master > page.

It would be nice if someone could briefly explain which storyboard elements, views, ViewModels and navigation elements are needed to realize such a SplitView.

Please do not simply link to the page: "documentation-plugins_ios-sidebar on MVVM Website" I can not Post links:(

Thank you and best regards

Addition: What have I done so far.
I have often implemented a "normal" navigation from one page to another without problems.
I used the Designer to place a SplitViewController on the Story Board. Then I created a .cs file for each controller (e.g. RootViewController.cs).

The views look like this:
[MvxFromStoryboard("LaunchScreen")] public partial class MasterViewController : MvxViewController<MasterViewModel>

Then I created a Root, Master and Detail ViewModel.
When navigating to the RootViewModel
await _navigationService.Navigate<RootViewModel>();

But then I get the following error:
$exception {System.NullReferenceException: Object reference not set to an instance of an object at MvvmCross.ViewModels.MvxViewModelLoader.LoadViewModel (MvvmCross.ViewModels.MvxViewModelRequest request, MvvmCross.ViewModels.IMvxBundle savedState, MvvmCross.Navigation.EventArguments.IMvxNavigateEventArgs navigationArgs) [0x00000] in D:\a\1\s\MvvmCross\ViewModels\MvxViewModelLoader.cs:62 at MvvmCross.Platforms.Ios.Views.MvxViewControllerExtensions.LoadViewModel (MvvmCross.Platforms.Ios.Views.IMvxIosView iosView) [0x0004d] in D:\a\1\s\MvvmCross\Platforms\Ios\Views\MvxViewControllerExtensions.cs:36 at MvvmCross.Views.MvxViewExtensions.OnViewCreate (MvvmCross.Views.IMvxView view, System.Func1[TResult] viewModelLoader) [0x00012] in D:\a\1\s\MvvmCross\Views\MvxViewExtensions.cs:24 at MvvmCross.Platforms.Ios.Views.MvxViewControllerExtensions.OnViewCreate (MvvmCross.Platforms.Ios.Views.IMvxIosView iosView) [0x00000] in D:\a\1\s\MvvmCross\Platforms\Ios\Views\MvxViewControllerExtensions.cs:17 at MvvmCross.Platforms.Ios.Views.MvxViewControllerAdapter.HandleViewDidLoadCalled (System.Object sender, System.EventArgs e) [0x00000] in D:\a\1\s\MvvmCross\Platforms\Ios\Views\MvxViewControllerAdapter.cs:24 at (wrapper delegate-invoke) <Module>.invoke_void_object_EventArgs(object,System.EventArgs) at MvvmCross.Base.MvxDelegateExtensions.Raise (System.EventHandler eventHandler, System.Object sender) [0x00000] in D:\a\1\s\MvvmCross\Base\MvxDelegateExtensions.cs:13 at MvvmCross.Platforms.Ios.Views.Base.MvxEventSourceViewController.ViewDidLoad () [0x00006] in D:\a\1\s\MvvmCross\Platforms\Ios\Views\Base\MvxEventSourceViewController.cs:62 at MvvmCross.Platforms.Ios.Views.MvxViewController.ViewDidLoad () [0x00000] in D:\a\1\s\MvvmCross\Platforms\Ios\Views\MvxViewController.cs:60 at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(intptr,intptr,intptr) at UIKit.UIWindow.set_RootViewController (UIKit.UIViewController value) [0x0000d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.10.0.17/src/Xamarin.iOS/UIWindow.g.cs:394 at MvvmCross.Platforms.Ios.Presenters.MvxIosViewPresenter.SetWindowRootViewController (UIKit.UIViewController controller, MvvmCross.Platforms.Ios.Presenters.Attributes.MvxRootPresentationAttribute attribute) [0x00025] in D:\a\1\s\MvvmCross\Platforms\Ios\Presenters\MvxIosViewPresenter.cs:624 at MvvmCross.Platforms.Ios.Presenters.MvxIosViewPresenter.SetupWindowRootNavigation (UIKit.UIViewController viewController, MvvmCross.Platforms.Ios.Presenters.Attributes.MvxRootPresentationAttribute attribute) [0x00023] in D:\a\1\s\MvvmCross\Platforms\Ios\Presenters\MvxIosViewPresenter.cs:260 at MvvmCross.Platforms.Ios.Presenters.MvxIosViewPresenter.ShowRootViewController (UIKit.UIViewController viewController, MvvmCross.Platforms.Ios.Presenters.Attributes.MvxRootPresentationAttribute attribute, MvvmCross.ViewModels.MvxViewModelRequest request) [0x00267] in D:\a\1\s\MvvmCross\Platforms\Ios\Presenters\MvxIosViewPresenter.cs:198 } System.NullReferenceException

Thank you and best regards

Answers

Sign In or Register to comment.