Search code examples
wpfresourcedictionary

WPF: Make Application Resources override usercontrol library resources


I have a wpf application project, with user controls in a separate project. I'd like to have different resource dictionaries in the different projects When I view the user controls from the user control project, I'd like to use the user control library's dictionary. when I run the Application, i'd like to use the application's dictionary. Right now, when i run the application, the application still has it's own dictionary, but the user controls are still using the user control library's dictionary I've tried combinations of dictionaries and merged dictionaries. Not really sure how to do this. thanks in advace


Solution

  • So I found a workaround: Include an App.xaml file in the user control library. Define the user control design time resources in the user control App.xaml file In the regular wpf application project, include the run time resources. At design time, the user controls only see its own App.xaml file, while at run time, the appliction is run and uses the resources defined in the application projects App.xaml file Don't know if this is the optimal method of doing this. If anyone has any comments on doing it this way, please feel free to post Thanks