Using Caliburn.Micro with Expression Blend in WP7

半腔热情 提交于 2019-12-11 06:23:16

问题


I just creating a little WP7 project using Caliburn.Micro as the MVVM framework, but I'm not sure of the best way of getting the project to work well with either Expression Blend or the Visual Studio designer.

How are people doing their design with Calibun.Micro? Am I best to ignore the conventions and use traditional binding mechanics so that Blend will understand the views? Is there any way to import Caliburn binding logic into Blend so that it recognises the conventions?

At the moment all of my views appear as empty controls and I need to run the application to get any idea of what things look like. I assume there is a better way that I'm missing.


回答1:


**Update: Design data with conventions is now built in to CM. http://caliburnmicro.codeplex.com/SourceControl/changeset/changes/c5cac07cd755 http://mnajder.blogspot.com/2011/09/design-time-support-for-caliburnmicro.html

I have been using the ViewModelLocator from MVVM Light and extending CM's Screen class adding the IsInDesignMode property. CM of course ignores conventions with any bindings set but its decent trade for a designer having mocked data.

"Is there any way to import Caliburn binding logic into Blend so that it recognises the conventions?"

Here is a post from the CM discussion about that.

Unfortunately, you know all there is to know. I've tried to explain these scenarios to the Blend team so that we can get the proper extensibility hooks in the product to make conventions work at design-time, but they just have a hard time understanding. They don't follow up on things and they are a very "closed" group inside or Microsoft. Silverlight and WPF MVPs don't necessarily have direct access to them. You have to be a Blend MVP. Those tend to be mostly designers and very few who understand larger scale development or even the benefits that conventions can give on simple projects. Doing this might be possible, but it would require a lot of very painful work and would probably break with the next release of Blend. The APIs for extensibility that are there are not very well documented. Then, there's also the issue of making it work in Visual Studio as well. Currently, I don't have the time or patience to try to come up with something. It's a great place where a contribution from the community would make a massive difference. I'm going to keep bugging the Blend team when I can. But, my guess is that they have other concerns.

I believe Rob talks a bit about this in this Hearding Code episode.

This isn't a demo intended for showing this but I was using the ViewModelLocator from MVVM Light in this bit of code to mock some data in a CM app.




回答2:


At the moment my approach is to use the Sample Data from Class functionality in Blend to generate design time data based off my View Model.

You're right that this does mean I'm not taking full advantage of Caliburn's convention based binding. However I still use it for elements that I don't need a design time experience for as well as for the conventions around Actions.



来源:https://stackoverflow.com/questions/6519647/using-caliburn-micro-with-expression-blend-in-wp7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!