CurrentViewModel Property

Jul 21, 2014 at 12:51 PM
I just found this toolkit and have an issue with creating a simple property to track the current ViewModel. I create a property as follows:
        private ViewModelBase _CurrentView;
        public ViewModelBase CurrentView
        {
            get { return _CurrentView; }
            set
            {
                _CurrentView = value;
                NotifyPropertyChanged(m => m.CurrentView);
            }
        }
However, this won't work as ViewModelBase requires a Type arguement (ie, ViewModelBase<MyViewModel>). Is there a way with SimpleMVVM to do this?

I am trying to implement some navigation as presented here (http://rachel53461.wordpress.com/2011/05/28/switching-between-viewsusercontrols-using-mvvm/) but because of the type requirement I cannot create the CurrentViewModel property. Is there another way to do this with SimpleMVVM?
Coordinator
Jul 22, 2014 at 6:27 AM
All you need is a common base class. Seeing as the base class for view models is generic, you would need to use object instead.
        private object _CurrentView;
        public object CurrentView
        {
            get { return _CurrentView; }
            set
            {
                _CurrentView = value;
                NotifyPropertyChanged(m => m.CurrentView);
            }
        }
Let me know if this works for you.

Cheers,
Tony