I have a C# (2008/.NET 3.5) class library assembly that supports WPF (based on this article).
I\'ve created several windows, and am now attempting to create a common style
So after spending a lot of time I finally figured this out. Here's how:
themes
.themes
folder, add a resource dictionary named generic.xaml
.Inside generic.xaml
, add your resource using the following syntax:
In your control, use the following syntax to access this resource:
Background="{StaticResource {ComponentResourceKey {x:Type local:UserControl1}, MyEllipseBrush}}"
Things to note:
ComponentResourceKey
's first parameter, but it is required. Use the name of the control that will consume this resource.Hope this makes some lives easier.