Trouble referencing a Resource Dictionary that contains a Merged Dictionary

前端 未结 5 605
野性不改
野性不改 2020-11-27 14:41

I have a library, CommonLibraryWpfThemes, with several Resource Dictionary XAML files in it. My Themes/Generic.xml file contains a ResourceDictionary.MergedDictionaries decl

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 15:20

    I was getting this error in my unit tests and Chris' answer from above gave me the clue I needed. Basically on my first tested method, I put:

            MyApplication.App app = new MyApplication.App();
            app.InitializeComponent();
    

    And suddenly it could find my template for my pages. Note: this does mean that you have to check to see if an instance of your App already exists if you are unit testing your App.cs as well.

提交回复
热议问题