滚动查看器 + WPF 应用程序中的堆栈面板
我在 Stackpanel 中有一个 Scrollviewer。如果我尝试用鼠标滚动向下滚动,它效果很好,但如果我使用滚动条上的滚动,它会减少并且页面不会向下滚动。此外,假设有一个由 5 个单选按钮组成的单选组(其中 2 个位于屏幕底部,3 个位于屏幕下方)。如果我尝试选择两个可访问的单选按钮之一,页面将向下滚动,直到看到所有五个单选按钮并且没有选中任何按钮。我该如何解决这个问题?
I have a Scrollviewer inside of Stackpanel. It works well if I'm trying to scroll down with a scroll on the mouse but if I use the scroll on the scroll bar it's being decreased and the page doesn't go down. Moreover, assume there's a radio group of 5 radio buttons(2 of them are on the bottom of the screen and 3 are lower). If I try to select one of two accessible radio buttons the page is scrolled down until all five are seen and no button is checked. How can I solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ScrollViewer 应该将 StackPanel 保存为内容,并且您必须在 ScrollViewer 上设置 MaxWidth/MaxHeight,超过该值 ScrollBar 将显示。
这是因为 StackPanel 不能很好地进行滚动,因为它只占用其内容所需的空间。
The ScrollViewer should hold the StackPanel as Content, and you have to set MaxWidth/MaxHeight on the ScrollViewer beyond which the ScrollBar will show.
This is because StackPanel doesn't play well with scrolling since it is made to take just the space needed for its content.