0

Maybe I'm missing something obvious here, but using MvvmCross and loading an view via a command:

    public ICommand LoadAnotherViewCommand
    {
        get { return new MvxCommand(() => ShowViewModel<MyOtherView>()); }
    }

How can I hook in and control the animation that occurs during the transition? Currently, all the transitions are left-to-right sliding transitions, but it's confusing when the user navigates back to a view and sees the same left-to-right transition.

Update:

I've been trying to figure out how to use a class derived from MvxTouchViewPresenter to achieve this with little success. I think I need to overload either Show(Cirrious.MvvmCross.ViewModels.MvxViewModelRequest request) and/or Show(Cirrious.MvvmCross.Touch.Views.IMvxTouchView view), but can quite figure out how to make it work. IMvxTouchView is ultimately derived from UIViewController so I can't use it in UIView.Transition. Also, determining which view is requested and which view I'm coming from seems a little confusing. If I look at request.ViewModelType I would expect to get the type of view model being requested, but instead it appears to be the view model you are coming from. Similarly, I would expect CurrentTopViewController to be the current view, but it appears to be the requested view?!? Also, I notice that trying to retrieve CurrentTopViewController causes a null reference exception if called to early (before any views have been presented). Presumably because internally _masterNavigationController is null.

Matt Burland
  • 44,552
  • 18
  • 99
  • 171
  • possible duplicate of: http://stackoverflow.com/questions/17731568/mvvmcross-ios-how-to-bind-a-command-with-custom-transition-when-switching-to-di – Stuart Jul 25 '13 at 14:06
  • @Stuart: Maybe, but the link doesn't exactly answer my question. I tried translating [this](https://gist.github.com/xjones/1394947) into a C# class and it sort of worked, but it seems to mess up the navigation controller. If I specify a `RootViewController` in the constructor of my presenter, then no navigation controller is created. – Matt Burland Jul 25 '13 at 17:01
  • Sorry - I'm struggling to read your update. A big paragraph brain dumps can sometimes help but right now the "?!?" just reads too confused to me. Rather than trying to solve everything in one step, maybe try breaking this down into one small transition which you are trying to achieve between two simple views in a simple test project. If you can do that then you can move on. If you can't then you can post a simple question with code about that problem. Will try to help. – Stuart Jul 25 '13 at 17:41

0 Answers0