Just a quick question, I’ve been searching for ages on Google. I have a storyboard:
<Storyboard x:Key="ViewLeftToRight" AccelerationRatio=".5" DecelerationRatio=".5">
<DoubleAnimation Storyboard.TargetName="ReferenceInfo" Storyboard.TargetProperty="Margin" Duration="0:0:0.15" To="{Binding, Width},0,0,0"/>
</Storyboard>
It doesn’t work. I was wondering if there is a way for me to bind the Width of the control to the “left” margin. If I need to use a converter, could you possibly show how it would be written in XAML in the above example?
Thanks!
No, you can’t bind an animation to
Margin, because it does not define a corresponding dependency property. There are several alternatives, here are two:Canvas.LeftandCanvas.TopRenderTransformon your object, and animate itsXandYproperties.1)
Here your storyboard short target the same element
ReferenceInfo, but target the attached properties, which you denote using brackets like “(Canvas.Left)”:2)
The animation would then reference the
TranslateTransformitself by name: