开发者

Using Caliburn.Micro with Expression Blend in WP7

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.


**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.


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜