Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

New Post: What is the difference between DisplayRootView and DisplayRootViewFor?

$
0
0
I've got a test app I'm using to learn C.M. Navagation from one screen to another only works if I use DisplayRootView as opposed to DisplayRootViewFor in my OnLaunched code. I would have thought the two should be equivalent. Here is my OnLaunched code:
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Initialize();

#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            var resumed = false;

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                resumed = navigationService.ResumeState();
            }

            if (!resumed)
                DisplayRootView<HomeCMView>();
        }
Here is how I do the navigation in my HomeCMView:
            _nav.DisplayViewModelFor<AddCMViewModel>();
If I replace DisplayRootView with DisplayRootViewFor (and change the object to be HomeCMViewModel), however, then the DisplayViewModelFor doesn't seem to do anything. I've got logging on and looking at the debug output there are no errors:
[Caliburn.Micro.ViewModelBinder] INFO: Binding Convention Applied: Element Title.
[Caliburn.Micro.ViewModelBinder] INFO: Binding Convention Applied: Element Abstract.
[Caliburn.Micro.Screen] INFO: Activating ViewModels.ViewModels.AddCMViewModel.
The debugging log looks identical to my eye (at least this part) when I use DisplayRootView.

I'm using C.M straight from CodePlex, checked out yesterday, and built on my machine. Is this a bug, or is there a subtly that I'm missing in what these guys mean?

Many thanks!

Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>