accessing a resource dictionary in code wpf

后端 未结 2 1214
时光说笑
时光说笑 2021-02-18 22:49

The same line of code in the same assembly works for one test fixture but not another. Here is the line of code:

var dic = new ResourceDictionary { Source = new          


        
2条回答
  •  遥遥无期
    2021-02-18 23:29

    What I use is with UriKind like

    var resource = new ResourceDictionary
    {
        Source = new Uri("/myAssemblyName;component/Themes/generic.xaml",
                         UriKind.RelativeOrAbsolute)
    };
    

    HTH

提交回复
热议问题