[WP8] ViewModel - View convention bug?

Topics: Bugs, Conventions
Mar 13, 2013 at 1:50 AM
I'm working on two projects using Caliburn.micro, the first is being developed in WP7 and works fine, the second with WP8 (the same structure) is not working properly.

I have a "ViewModels" folder and a "Views" folder. The Views folder has a page "ManageChecklistView", and the folder ViewModels has a ViewModel "ManageChecklistViewModel" that inherits from Screen.
I setup the viewmodel in the bootstrapper:
container.PerRequest<ManageChecklistViewModel>();
In MainPage there is a method to navigate to that viewmodel with this code:
navigationService.UriFor<ManageChecklistViewModel>().Navigate();
An exception is occurring when frame is navigating, in the NavigationFailed event.
System.InvalidOperationException: No XAML was found at the location '/ Views / ManageView.xaml'.
Both projects are with version 1.4.1.

Has anyone gone through this and could help me?
Mar 13, 2013 at 6:06 AM
Edited Mar 13, 2013 at 6:07 AM
I would say you have a namespace miss-match. Assuming have a ManageChecklistView.xaml for the ManageChecklistViewModel to navigate to it..

And you are sure you have the WP8 binaries for your WP8 variant...

Morgan
Mar 13, 2013 at 12:13 PM
Hi Morgan.

Both classes are in the same root namespace "Checklist", could this be the problem?
Checklist.ViewModels.ManageChecklistViewModel
Checklist.Views.ManageChecklistView
WP8 project has a reference to Caliburn.Micro for WP8, and WP7 project to Caliburn.Micro for WP7.

Thanks.
Mar 13, 2013 at 12:16 PM
I'll try to change the root namespace later and let you know if it worked.

Thanks.
Mar 13, 2013 at 5:06 PM
Edited Mar 13, 2013 at 5:08 PM
THen that should have found the correct view association. Not sure why it would producing a /Views/ManageView.xaml error since you didn't indicate that as the view to navigate to. It should have been /Views/ManageChecklistView.xaml, which as you say existed.

I had a project in WP7 that I changed to WP8 and it doesn't exhibit this behavior. :(

Also what does your WPManifest have for the start page? Does the start page reside in the Views fold as well?
Mar 21, 2013 at 1:52 AM
Hi.
I simply changed the viewmodel name and view name to ManageCheckListViewModel and ManageCheckListView respectively, now it worked fine.
I also created another project with different name and it worked too. Viewmodels and views can't contain the root namespace in the name (in my case "Checklist").

Thanks Morgan.