Effect Template Binding
Posted: 05 Jan 2022, 21:32
Should I be able to template bind color to an effect object? I am able to bind other properties but with effects and color I can't seem to get it to work. I also tried brushes using SolidColorBrush. Thank you!
// Style
// User Control
// usage
// Style
Code: Select all
<Style TargetType="local:RadialRangeControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:RadialRangeControl">
<Path Name="PART_Value"
<Path.Effect>
<DropShadowEffect BlurRadius="15" ShadowDepth="0" Opacity="1" Color="{TemplateBinding ValueShadowColor}"/>
</Path.Effect>
</Path>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Code: Select all
public static readonly DependencyProperty ValueShadowColorProperty =
DependencyProperty.Register(nameof(ValueShadowColor), typeof(Color), typeof(RadialRangeControl), new PropertyMetadata(Colors.Transparent));
public Color ValueShadowColor
{
get { return (Color)GetValue(ValueShadowColorProperty); }
set { SetValue(ValueShadowColorProperty, value); }
}
Code: Select all
<local:RadialRangeControl ValueShadowColor="Red" />