弹出窗口中的 WPF 手风琴控件
我按照此链接使用手风琴控件 - 是否有一个 WPF 控件可以用来展开/折叠面板(动画)
问题是我希望这个控件由 Popup 托管。问题是,当我展开任何组时,弹出窗口的大小不会调整。如果我给弹出窗口一个固定的大小,那么项目就会展开,但这是一个丑陋的效果,因为你第一次看到一个大的弹出窗口,上面有一些折叠的项目。宁愿让弹出窗口随着项目展开和/或折叠而调整大小。
有什么建议吗?
谢谢。
编辑:看来我完全错了。我不需要使用手风琴控件。刚刚将扩展器放入网格中,使每行高度=“自动”。展开/折叠组时,弹出窗口可以很好地调整大小。
I'm using an Accordion control as per this link - Is there a WPF control I can use to expand/collapse panels (animated)
The problem is that I'd like this control to be hosted by a Popup. Problem is that the Popup does not get resized when I expand any of the groups. If I give the popup a fixed size, then the items get expanded, but it's an ugly effect, because the first time you see a large popup with a few collapsed items on top. Would rather have the popup resizing as the items expand and/or collapse.
Any suggestions?
Thanks.
EDIT: Looks like I totally got it wrong. I didn't need to use the Accordion control. Have just put the expanders within a grid, giving each row Height="Auto". The popup resizes nicely when expanding/collapsing the groups.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我真的很讨厌WPF的默认Popup,所以通常使用我自己的。其代码可以在此处找到
。弹出内容的大小基于弹出窗口内内容的大小。下面是一个如何使用它的粗略示例:
I really hate WPF's default Popup, so usually use my own. The code for it can be found here
The default size of the Popup Content is based on the size of the content inside the popup. Here's a rough example of how it can be used:
您可以使用绑定到手风琴控件的 ActualHeihgt 属性来设置弹出窗口的高度。
它看起来像这样:
但是你肯定会设置一个高度限制。可以使用带有参数的转换器来解决。
You could set height of the popup using binding to the ActualHeihgt property of your accordion control.
It will look like that:
But you'll definitely to set a height limit. Could be solved using converter with parameter.