Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create Views and ViewModels with Caliburn.Micro in Windows Phone

Ok,

I have decided to take a look at calibun micro as people are raving about it. Note that this question is in the context of Windows Phone 7.

I have downloaded the package from nuget, cleared out the app.cs and added the bootstrapper to app.xaml. I have also created 3 folders Model, View, ViewModel.

What I would like to do first is just create a simple window with 3 textblocks but can't seem to find out how. I have read the soup to nuts and I just can't get it. I also note that Caliburn.Micro is a vm first approach but in WP7 you have to navigate to a page first.

Could anyone explain how to set up my first View and ViewModel, I think once I have that I can start from there.

Thanks a mill!

like image 939
deanvmc Avatar asked Jan 17 '26 01:01

deanvmc


1 Answers

In your ViewModels folder, create a class called MyFirstViewModel. In your views folder, create a PhoneApplicationPage called MyFirstView. That's all you need. However, the phone is hardcoded to show a certain page first, so you need to update your WMAppManifest.xml if you want it to work the way you described. In that case, you need to change the DefaultTask so that it's NavigationPage property points to MyFirstView. Have a look at the HelloWP7 sample for a general demonstration of the framework's phone features.

like image 117
EisenbergEffect Avatar answered Jan 19 '26 18:01

EisenbergEffect



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!