开发者

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

开发者 https://www.devze.com 2023-03-15 12:53 出处:网络
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.

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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号