I'm trying to do something like this...
<Style
x:Key="MyBorderStyle"
TargetType="Border">
<Setter
Property="BorderBrush"
Value="{StaticResource MyBorderBrush}" />
<Setter
Property="Background"
Value="{StaticResource MyBackgroundBrush}" />
<Setter
Property="Padding"
Value="{TemplateBinding Padding}" />
</Style>
...but I get the error: 'Padding' member is not valid because it does not have a qualifying type name.
How do I provide a "qualifying type name"?
Note: The reason I'm trying to do this, is that I'd like to include the same Border in a series of similar ControlTemplates.
Thanks.
EDIT:
Well I tried this...
<Setter
Property="Padding"
Value="{TemplateBinding GridViewColumnHeader.Padding}" />
...and it actually compiled, but then when I ran the app, I got a XamlParseException
:
Cannot convert the value in attribute 'Value' to object of type ''.
I thought maybe qualifying Padding
with GridViewColumnHeader
(which is the ControlTemplate I want to use this style with) would work, but no dice.
EDIT 2:
Well, according to the documentation for TemplateBinding
, it says:
Links the value of a property in a control template to be the value of some other exposed property on the templated control.
So it sounds like what I'm trying to do is just plain impossible. I really would like to be able create reusable styles for certain controls in my control templates, but I guess the template bindings cannot be included in these styles.