Consider , we have a storyboard in the MainPage.xaml in Silverlight 3 :
<UserControl.Resources>
<Storyboard x:Name="muthu">
<DoubleAnimation Storyboard.TargetName="mybutton" Storyboard.TargetProperty="Width" From="0"To="200"/>
</Storyboard>
</UserControl.Resources>
We can link that storyboard to a dynamically created button control like this :
string xaml = @"<Button xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" x:Name=""mybutton""/>";
Button btn = (Button)XamlReader.Load(xaml);
this.LayoutRoot.Children.Add(mybutton);
Storyboard.SetTarget(this.sb.Children[0], mybutton);
this.sb.Begin();
No comments:
Post a Comment