Navigation for Onyx

Sep 3, 2009 at 10:42 AM

Good day Bill.

Thank you for your project.

I think I solve the problem with Navigation issue for Onyx.

I can write small note about it on codeproject.


Sep 6, 2009 at 10:50 AM

Navigation in MVVM applications (Onyx)

Oct 12, 2009 at 4:43 PM

For anyone else who may be interested,

I came at this issue from another angle with reasonably good results.  I just created a view registry and wired into my ServiceRegistryActivator.  You can see the same concept applied and explained better in some of the other frameworks that are out there, but bascially somewhere in the loading/config code for the app all of the necessary views that are out there are "registered" for there associated viewmodel type.  At runtime any viewmodel that needs to open another view call a "resolve" method to get the view for the viewmodel to navigate to.  I use this purely for situations where straight datatemplates are not an option (like when the view is a window), but I think the same concept could be applied in other instances.  I don't claim to be the expert here (Bill is), but this approach has definitely helped me get over the aforementioned hump.  Besides this is another one of those thorny issues in MVVM for which I've never seen the all-inclusive solution.  So I'd really like to see this dicussion run its course.  At any rate, my registry looks as follows ...

 public interface IViewRegistry
        void Register<T, D>()
            where T : ViewModelBase
            where D : System.Windows.DependencyObject;

        Onyx.Windows.View Resolve<T>() where T : ViewModelBase;

        Onyx.Windows.View Resolve<T>(T instance) where T : ViewModelBase;

        void Unregister<T>() where T : ViewModelBase;