WPF 类库中的全局静态资源?
在 WPF 应用程序中,您可以将全局静态资源放入 app.xaml 中……就像
<Application.Resources>
<!--Global View Model Locator-->
<vm:ViewModelLocator x:Key="Locator"
d:IsDataSource="True" />
</Application.Resources>
来自 MVVM Light 的那样;)。现在,如果您的项目是 wpf 类库,那么初始化此类全局静态资源的正确方法是什么?
In a WPF application, you can put your global static resources in app.xaml .. like
<Application.Resources>
<!--Global View Model Locator-->
<vm:ViewModelLocator x:Key="Locator"
d:IsDataSource="True" />
</Application.Resources>
That was from MVVM Light ;). Now, if your project is a wpf class library, what is a proper way to initialize such global static resources?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用您的资源创建一个 ResourceDictionary,并使用您的代码合并字典,如下所示。
代码:
You can create a ResourceDictionary with your resources and merge the dictionaries using your code as below.
Code: