0

I don't seem to be able to access remote resources from an external assembly.

The following line in MainWindow.xaml isn't working, no background color is getting displayed:

<StackPanel Grid.Row="0" Background="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type res:DummyForSharingResources}, ResourceId=TestBg}}"></StackPanel>

I published a corresponding repository to GitHub containing my Visual Studio 2019 solution. It contains all the details.

What I did so far

  • "Themes/generic.xaml" file created in supplemental assembly (StylesAndResources), filled with resources.
  • ThemeInfoAttribute updated in application assembly to reference ResourceDictionaryLocation.ExternalAssembly.
  • Dummy class created in StylesAndResources in order to be able to have a ComponentResourceKey be generated.

What am I doing wrong?

AxD
  • 2,714
  • 3
  • 31
  • 53
  • [ResourceDictionary in a separate assembly](https://stackoverflow.com/questions/338056/resourcedictionary-in-a-separate-assembly) – Pavel Anikhouski Jan 10 '21 at 16:14
  • I'm aware of the pack UIR syntax, yet the "correct" way for theming, suggested by [Microsoft](https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/control-authoring-overview#defining-resources-at-the-theme-level), is to use a ComponentResourceKey. I'm about to give WPF courses where people may ask me how to solve their issues. So, I need to get the above version running. – AxD Jan 10 '21 at 20:22

0 Answers0