开发者

common storyboard for all silverlight forms

am having a two storyboards formOpenStory and formCloseStory. am having many usercontrols as form, when ever i open and close i need to call the storyboard to begin, how to write a global story board 开发者_运维百科for all the common animations in the form.


In app.xaml

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
         x:Class="SilverlightApplication1.App">


<Application.Resources>
<Storyboard x:Name="StoryBoard1">
  <DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform)"  />
</Storyboard>
<Storyboard x:Name="StoryBoard2">
  <DoubleAnimation Duration="0:0:0.2" To="180" Storyboard.TargetProperty="(UIElement.RenderTransform)"  />
</Storyboard>

and you can use like below where ever you want

Storyboard sb = Application.Current.Resources["StoryBoard1"] as Storyboard;
  Storyboard.SetTarget(sb, myControl1);
  sb.Begin();    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜