动画 WPF 菜单
如果我有类似的内容:
<StackPanel Orientation="Horizontal">
<TextBlock Text="FIRST" Margin="5" VerticalAlignment="Center" />
<TextBlock Text="SECOND" Margin="5" VerticalAlignment="Center" />
<TextBlock Text="THIRD" Margin="5" VerticalAlignment="Center" />
<TextBlock Text="FOURTH" Margin="5" VerticalAlignment="Center" />
<TextBlock Text="FIFTH" Margin="5" VerticalAlignment="Center" />
</StackPanel>
您能否向我展示如何创建一个动画,其中 TextBlock
将从屏幕右侧逐个滚动?
你能给我看一个类似的例子吗?
我知道我可能需要使用 Canvas
而不是 StackPanel
,但如何正确排列它们我不知道......
If I have something like:
<StackPanel Orientation="Horizontal">
<TextBlock Text="FIRST" Margin="5" VerticalAlignment="Center" />
<TextBlock Text="SECOND" Margin="5" VerticalAlignment="Center" />
<TextBlock Text="THIRD" Margin="5" VerticalAlignment="Center" />
<TextBlock Text="FOURTH" Margin="5" VerticalAlignment="Center" />
<TextBlock Text="FIFTH" Margin="5" VerticalAlignment="Center" />
</StackPanel>
Could you please show me how can I create an animation where TextBlock
s will roll out from the right side of the screen, each after another?
Could you show me a similar example?
I know that I probably gonna need to use Canvas
instead of StackPanel
, but how to arrange them properly then I don't know...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个有两个示例的答案。如果您确实想在 StackPanel 中使用 TextBlock,我已经展示过。但是,如果您实际上正在寻找菜单,我也包含了该示例。这两个示例实际上是相同的 - 只是获得动画变化的对象。
Here is a two-example answer. If you truly want to use TextBlocks in a StackPanel, I've shown that. However, if you are actually looking for a menu, I've included that example as well. Both examples are really the same - just the object that gets animated changes.