I am having difficulty getting the correct syntax in ControlTemplate. Here is the basic information:
<ControlTemplate TargetType="{x:Type foo:bar">
<Border Name="Bd">
<Border.BorderBrush>
<SolidColorBrush Color="{DynamicResource DefaultBorderBrushLightBrush}" />
</Border.BorderBrush>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="(Border.BorderBrush).(SolidColorBrush.Color)"
TargetName="Bd"
Value="{DynamicResource PressedBorderDarkColor}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate
This gives the msg error
Cannot resolve the Color property of the template. Verify that the owner type is a TargetType type, or use the Class.Property syntax to specify a property.
This seems clear enough - I am not correctly specifying the target property. I tried this in several different ways. In particular, I tried
<Setter Property="BorderBrush" TargetName="Bd">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource PressedBorderDarkColor}" />
</Setter.Value>
</Setter>
... and this creates, and, I believe, gives me what I was looking for.
But why can't I set the color of the brush? How can I specify it?
, " Class.Property"? MSDN XAML , , , .