【发布时间】:2015-08-02 22:59:38
【问题描述】:
我尝试从 app.xaml 获取动画(向上/向下移动标签,如消息弹出窗口)。不过,当我尝试获取故事板时
app.xaml:
<Storyboard x:Key="AnimatedMessage">
<DoubleAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)"
Duration="0:0:10"
AutoReverse="True">
<LinearDoubleKeyFrame Value="100" KeyTime="0:0:2"/>
<LinearDoubleKeyFrame Value="200" KeyTime="0:0:4"/>
<LinearDoubleKeyFrame Value="300" KeyTime="0:0:6"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
我的后台:
Storyboard SBStartAnimation = (Storyboard)this.FindResource("AnimatedMessage");
Storyboard.SetTarget(SBStartAnimation, LBAnimateMessage);
SBStartAnimation.Begin(this);
但这怪我,我不能为storyboard-object设置属性,因为它是只读的。
更新:
我喜欢动画的标签:
<Label Content="" Name="LBAnimateMessage" Visibility="Hidden" Width="600" Style="{StaticResource Style_BasicMessage}" Margin="10,303,235,38"/>
【问题讨论】: