admin管理员组文章数量:1122832
I'm quite new to wpf and I have a desktop project where several applications are running at the same time on different PCs. Some of the screens are the same in the different applications. As we do with the backend (the common code is in several class libraries), I would like to do the same for the frontend. I created a WPF class library and inside, I moved all the resources, some need code for communicating with backhand and I tried to move some usercontrols (WPF) to reuse them in the different applications. My problem is, when I try to use the usercontrol moved into the lib, the app cannot find the viewModel file (when the usercontrol is added directly in the WPF) or the view file (when I use a contentControl). I'm using the caliburn.micro framework, for all apps 6.0 framework and I'm using the standard naming conventions in the lib and all the frontend apps.
What should I do to move/create usercontrols in a WpF class library and use them in my projects?
I tried to rewrite usercontrols moved to lib to no longer use caliburn.micro (only in WPF calss library) I tried to instantiate viewModel and assign to the dataContext of the corresponding view added directly as an object in my WPF. In the Bootstrapper I have added/changed:
protected override IEnumerable<Assembly> SelectAssemblies()
{
return AppDomain.CurrentDomain.GetAssemblies().ToArray();
}
ViewLocator.AddSubNamespaceMapping("abcd.WPFLib.*.ViewModels","abcd.WPFLib.*.Views");
Thanks
本文标签: wpf controlsUse create a WPF Class LibraryStack Overflow
版权声明:本文标题:wpf controls - Use create a WPF Class Library - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736304312a1932191.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论