隐藏 WPF StackPanel(非扩展器)时出现问题
我在 WPF StackPanel
方面遇到了真正的麻烦 - 我需要使其动画化,不仅可以水平滚动其内容(这或多或少是可以的),而且我还必须使其展开/折叠(动画)通过按包含窗口上的某个按钮。
我尝试过很多动画扩展器控件(例如 http://www.codeproject.com /KB/WPF/AnimatingExpander.aspx),但它们的功能已超载(以及一些包含控件的工件),不适合我的任务。
所以问题是如何使简单的水平方向的 StackPanel 通过单击按钮以动画方式展开/折叠?
I have a real trouble with WPF StackPanel
- I need to make it animated not only for scrolling its content horizontaly (this is ok more or less), but also I must make it expand/collapse (animated) by pressing some button on the containing window.
I have tried a lot of animated expander controls (for example http://www.codeproject.com/KB/WPF/AnimatingExpander.aspx) but they have overloaded with functionality (and some artifacts with contained controls) and not suitable for my task.
So the question is how to make SIMPLE horizontal oriented StackPanel
to expand/collapse with animation by button click?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的方法是在
ToggleButton.Checked
或.Unchecked
事件上启动动画:The simplest approach is to start an animation on a
ToggleButton.Checked
or.Unchecked
event:为什么不为堆栈面板的宽度添加故事板和双动画。通过单击按钮,您可以通过代码或定义事件触发器来启动动画。
Why not adding a storyboard and double animation for stackpanel's width. By clicking the button you can start the animation in code or by defining event triggers.