Doubleanimation bind To property dynamically in Silverlight:
Doubleanimation bind To property dynamically in Silverlight:
- Some time we may not know the To value for the Doubleanimation property at design time,For example in my case i have an datagrid, i'm going to bind that datagrid height as To property,but i bind the itemSource for the datagrid dynamically.
- So in that situation i get the height of the datagrid after Binding the dataSource using C#, and i assigned the height value to Datagrid tag property, And finally i can bind that tag property to the Doubleanimation 'To' property
xaml code:
<Storyboard x:Name="animation" Storyboard.TargetProperty="(Canvas.Top)" RepeatBehavior="Forever">
<DoubleAnimation Storyboard.TargetName="YourControlName" From="20" To="{Binding Tag, ElementName=DataGridName}" Duration="0:0:15" /> </Storyboard>
C# code:
After Binding the item source use the following code
DataGridName.Tag = -dgNewsAndAlerts.ActualHeight; //-value for To property
Comments
Post a Comment