开发者

Sharing Silverlight and WPF Models with MVVM Light

开发者 https://www.devze.com 2023-03-11 04:00 出处:网络
I have a Silverlight class library which is a model in my MVVM app. I am using MVVM Light. How easy is it reuse that model in a WPF app and use the MVVM Light framework. The framework has different dl

I have a Silverlight class library which is a model in my MVVM app. I am using MVVM Light. How easy is it reuse that model in a WPF app and use the MVVM Light framework. The framework has different dl开发者_Go百科ls for WPF and Silverlight so I guess there is incompatability of sorts. I was wondering if anyone could talk me through the options. Cheers, Chris.


The suggested option is to use the Project Linker, this tool synchronizes code over multiple projects, allowing you to maintain a Silverlight and WPF dll with one codebase.


I hope you mean model means data in WPF and Silverlight. If that is the case, you can expose the data using a Service. It can be any service like web service, WCF service or WCF RIA service. Since a service can be multi tenented you can have a Silverlight as well as WPF client accessing the same service.

If you are trying to share the ViewModels between Silverlight and WPF using MVVM light, I would suggest you have a look at the MIX 2011 video of the presentation by the creator of MVVMLight library Laurent Bugnion. This is called Deep Dive MVVM and is a very good session. In short you can share ViewModels between WPF and Silverlight by adding the file from one project to another as a "LINK".

Hope this helps

0

精彩评论

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