So I have a control template that looks a bit like this
<ControlTemplate TargetType="{x:Type local:OptionCheckBox}">
<Grid>...</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.5" BeginTime="{TemplateBinding AnimationDelay}" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
This is a default template for a control that defines the dependency property:
public static readonly DependencyProperty AnimationDelayProperty;
static OptionCheckBox()
{
var animationDelayMeta = new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(AnimationDelayChangedHandler));
AnimationDelayProperty = DependencyProperty.Register("AnimationDelay", typeof(TimeSpan?),
typeof(OptionCheckBox), animationDelayMeta);
}
Everything looks perfectly legit to me, yet when I run this I get the error
Cannot convert the value in attribute 'BeginTime' to object of type ''.
So as the BeginTime property type is Nullable I thought this would be fine. I have tried setting the default value just to new TimeSpan(), but this doesn't work. I'm sure there's something glaringly obvious. Any ideas?