I've spent the last few days trying to figure out a way to get around the warning:
mvx: Warning: 8.93 Exception masked MissingMethodException: Default constructor not found for type FCX.iOS.TimesheetView at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00094] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:326 at System.Activator.CreateInstance (System.Type type) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:222 at Cirrious.MvvmCross.Touch.Views.MvxTouchViewsContainer.CreateView (Cirrious.MvvmCross.ViewModels.MvxViewModelRequest request) [0x00000] in :0 at Cirrious.MvvmCross.Touch.Views.MvxCanCreateTouchViewExtensionMethods.CreateViewControllerFor (IMvxCanCreateTouchView view, Cirrious.MvvmCross.ViewModels.MvxViewModelRequest request) [0x00000] in :0 at Cirrious .MvvmCross.Touch.Views.Presenters.MvxTouchViewPresenter.Show (Cirrious.MvvmCross.ViewModels.MvxViewModelRequest request) [0x00000] in :0 at Cirrious.MvvmCross.Touch.Views.MvxTouchViewDispatcher+<>c__DisplayClass4.b__3 () [0x00000] in :0 at Cirrious.CrossCore.Core.MvxMainThreadDispatcher.ExceptionMaskedAction (System.Action action) [0x00000] in :0
It appears the navigation is looking for this constructor:
public TimesheetView ()
{
}
When I WANT it to use this constructor (for storyboard purposes):
public TimesheetView (IntPtr handle) : base (handle)
{
}
I've been trying to bind a button from one view to the following ICommand:
private MvxCommand _NewTimesheetCommand;
public ICommand NewTimesheetCommand
{
get
{
_NewTimesheetCommand = _NewTimesheetCommand ?? new MvxCommand(() => {
ShowViewModel<TimesheetViewModel>(new TimesheetViewModel.Parameters { Mode = TimesheetViewModel.ModeEnum.ADD });
});
return _NewTimesheetCommand;
}
}
After looking at many StackOverFlow questions, I came across this question, but it almost sounds that using storyboards REQUIRES me to use segues (in other words there isn't a way to use ICommand to change my view).
Does MvvmCross support storyboards
My main question: Is it possible to use storyboards and change the view with the viewmodel? (rather than using segues from the view)