I have a CustomControl really simple
public class LoadingIndicator : Control
{
public double SpeedRatio
{
get { return (double)GetValue(SpeedRatioProperty); }
set { SetValue(SpeedRatioProperty, value); }
}
// Using a DependencyProperty as the backing store for SpeedRatio. This enables animation, styling, binding, etc...
public static readonly DependencyProperty SpeedRatioProperty =
DependencyProperty.Register("SpeedRatio", typeof(double), typeof(LoadingIndicator), new PropertyMetadata(1.0));
static LoadingIndicator()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(LoadingIndicator), new FrameworkPropertyMetadata(typeof(LoadingIndicator)));
}
public LoadingIndicator()
{
}
}
I'd like to make a binding with the SpeedRatio of my control and the SpeedRatio of the storyboard and it's appear that it doesn't want. I have an exception System.Windows.Markup.XamlParseException
<Style TargetType="{x:Type local:LoadingIndicator}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:LoadingIndicator}">
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="local:LoadingIndicator.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard SpeedRatio="{TemplateBinding SpeedRatio}" RepeatBehavior="Forever" Duration="0:0:1.000">
...
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
If I remove the TemplateBinding it's works fine.