I can't figure out why this XAML code does not work. When using a TemplateBinding (see below), the background color is not set. But when I use a normal color string (i.e. "Red"), it works fine.
<ControlTemplate x:Key="InstanceButtonTemplate" TargetType="{x:Type Control}">
<Grid>
<Rectangle>
<Rectangle.Fill>
<SolidColorBrush Color="{TemplateBinding Background}"></SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
</Grid>
</ControlTemplate>
Yet, when I use a TemplateBinding in this way, it works Fine...
<ControlTemplate x:Key="InstanceButtonTemplate" TargetType="{x:Type Control}">
<Grid>
<Rectangle Fill="{TemplateBinding Background}"></Rectangle>
</Grid>
</ControlTemplate>
Any ideas?
Edit: to clarify, I intend to expand this to rather use a gradient brush, that's why I need to be able to assign to the Rectangle.Fill property using XAML instead of a plain string.