WPF UserControl cannot find XAML resource in referencing project

后端 未结 5 479
盖世英雄少女心
盖世英雄少女心 2020-12-06 04:55

In my WPF project i keep a user control in a separate library project. The user control accesses resources in a separate XAML file, like this:



        
5条回答
  •  情话喂你
    2020-12-06 05:24

    In my case I had the ResourceDictionary and the UserControl on the same Library, but separate from the main application. What worked for me was specifying the name of the assembly in the format Adam suggested in the comment AND I had to change the ResourceDictionary in the project from Embedded Resource to Page. I didn't try using the pack:// format, but I assume it would work too.

    
    

提交回复
热议问题