Reputation: 6953
I am writing a Windows Phone 8 app that manages jobs. I am using Caliburn Micro for MVVM duties.
Simplified overview: Page 1 shows a list of jobs. User selects a job. App shows relevant page - either page 2 for job type "Clean Dishes" or page 3 for job type "Vacuum Floor". All pages are view models.
So far so good.
The user can also press a plus button to add a new job. I need to show a list of job types to determine whether to show page 2 or page 3.
I would prefer that the job type list be a view model. If I make it a page it gets put in the back stack which I don't want. I don't know how to display a user control based view model from within a page. This is a port of a WPF app and there I would use WindowManager to display a view model in a modal dialog.
Options
Has anyone overcome a similar issue? Any ideas?
Upvotes: 0
Views: 311
Reputation: 7135
You can have your job type list in its own page and remove it from the back stack. Just add some code to OnNavigatedFrom
event
protected override void OnNavigatedFrom(NavigationEventArgs e) {
base.OnNavigatedFrom(e);
NavigationService.RemoveBackEntry();
}
This will cause it be removed from the back stack when you navigate to either page 2 or page 3.
Upvotes: 1