为了优化我的应用程序,我创建了一个SharedResourceDictionary.有了这个,我在运行时节省了大约250 MB的内存,所以它运行良好.
我的问题出在设计时,在Blend 4中,我无法访问我的资源.要修改模板(女巫在我的资源文件中),我通常右键单击我的控件,然后选择编辑模板 - >编辑当前,如下图所示:

我需要修改我的模板,它比我的资源文件快100倍,找到好的...我有很多资源......
我的SharedResourceDictionary是这样实现的(在网上找到):
public class SharedResourceDictionary : ResourceDictionary
{
/// <summary>
/// Internal cache of loaded dictionaries
/// </summary>
public static Dictionary<Uri, ResourceDictionary> _sharedDictionaries =
new Dictionary<Uri, ResourceDictionary>();
/// <summary>
/// Local member of the source uri
/// </summary>
private Uri _sourceUri;
/// <summary>
/// Gets or sets the uniform resource identifier (URI) to load resources from.
/// </summary>
public new Uri Source
{
get
{
if (IsInDesignMode)
return base.Source;
return _sourceUri;
}
set
{ …Run Code Online (Sandbox Code Playgroud)