是否可以将一个 Storyboard 资源作为另一个 Storyboard 的子资源包含在内?
我知道故事板因其所有的可自由性而很棘手,但是是否可以与多个故事板共享动画?我正在尝试做的事情大致如下:
<UserControl.Resources>
<Storyboard x:Key="SharedAnimation" />
</UserControl.Resources>
...
<VisualState Name="Animation1">
<Storyboard SpeedRatio="1">
<Somehow include SharedAnimation />
</Storyboard>
</VisualState>
<VisualState Name="Animation2">
<Storyboard SpeedRatio="1.5">
<Somehow include SharedAnimation />
</Storyboard>
</VisualState>
...
I know Storyboards are tricky with all of their freezableness, but is it possible to share an animation with multiple Storyboards? Something along the lines of the following is what I'm trying to do:
<UserControl.Resources>
<Storyboard x:Key="SharedAnimation" />
</UserControl.Resources>
...
<VisualState Name="Animation1">
<Storyboard SpeedRatio="1">
<Somehow include SharedAnimation />
</Storyboard>
</VisualState>
<VisualState Name="Animation2">
<Storyboard SpeedRatio="1.5">
<Somehow include SharedAnimation />
</Storyboard>
</VisualState>
...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有在这里尝试,因为我目前这台机器上没有 VS,但这可能有效:
I didn't try it here because I currently don't have VS in this machine, but this might work: