WPF-删除resourcedictionary会产生问题 [英] Wpf - Removing resourcedictionary creates problem

查看:117
本文介绍了WPF-删除resourcedictionary会产生问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.
我有一个wpf应用程序.
我为键入的样式的按钮,标签,组合框等制作了一个资源文件.

现在,我在一个窗口中使用一个第三方控件,该窗口将从应用程序中弹出.

现在,当我使用以下代码加载弹出窗口时删除资源文件时,

ResourceDictionary皮肤= new ResourceDictionary(); skin.Source =新的Uri(@"Skins \ Skin.xaml",UriKind.Relative); Application.Current.Resources.MergedDictionaries.Remove(皮肤);

这样,它也不会在我的应用程序中应用样式.

我在做什么????/

Hi.
I have a wpf application.
I made one resource file for buttons, labels, comboboxes, etc. which are typed styles.

Now i am using one third party control in one window which i will popup from my application.

Now when i remove resource file when the popup window loaded using following code,

ResourceDictionary skin = new ResourceDictionary(); skin.Source = new Uri(@"Skins\Skin.xaml", UriKind.Relative); Application.Current.Resources.MergedDictionaries.Remove(skin);

By doing this, it also not apply styles in my application.

Is there anything wrong i m doing???/

推荐答案

如果删除资源文件,则* application *将找不到它.我认为您自己的方法是将资源文件合并到需要它的每个窗口中(并从app.xaml文件中删除).
If you remove the resource file, your *application* won''t find it. I think your ownly recourse is to merge the resource file in each window that needs it (and take the merging out of your app.xaml file).


这篇关于WPF-删除resourcedictionary会产生问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆