componentresourcekey

How do I get the actual resource from a ComponentResourceKey?

I have a ComponentResourceKey defined in my resource dictionary like this: <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:Resources}, ResourceId=BaseControlStyle}" TargetType="{x:Type FrameworkElement}"> <Setter Property="Margin" Value="4,4,0,0" /> </Style> I have a static class that I use as a shortcut to ...

Getting a ComponentResourceKey to Work?

I am building a WPF app with several assemblies, and I want to share a resource dictionary among them. That requires a ComponentResourceKey. I have built a small demo to test out the CRK, and I can't seem to get it working. My demo has two projects, a WPF project called Demo, and a DLL called Common. The Common project has a folder call...

ComponentResourceKey as DynamicResource problem

Hi, I'm seeing some unexpected behavior using ComponentResourceKey. The problem came up because I was using names used in the SystemColors class. Consider the following code: First I expose a ComponentResourceKey in a as a static property: public enum ColorKeys { ControlColor } public class MyColors { public static Compon...

ComponentResourceKey that uses DynamicResource for value

I'm trying to define a set of brushes using ComponentResourceKey notation that align themselves with the colors provided by the SystemColors object. Here's what I know how to do (I have an example that follows): 1) I know how to define an inline brush that uses the SystemColors object (Brush1 in my example) 2) I know how to define and...

WPF ResourceDictionary Item has already been added using ComponentResourceKey

Hello, I have the following ResourceDictionary that gets merged into my Themes/Generic.xaml file <DataTemplate DataType="{x:Type model:RequirementResourceRelation}" x:Key="{x:Static local:Resources.RequirementResourceRelationListTemplateKey}"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> ...

WPF StaticResource works, DynamicResource doesn't

Hi, I have been trying for a day now, to no avail, to create a bunch of brushes in the theme then using them with DynamicResource in a custom control. What I did is this: create the theme generic.xaml which contains styles (works) add a dictionary to merge in generic.xaml to contain brushes used in the application (works) make brushes ...