为 WPF 树视图启用滚动

编程入门 行业动态 更新时间:2024-10-06 22:31:01
本文介绍了为 WPF 树视图启用滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

任何人都可以帮助我了解如何启用树视图滚动?必须有一个简单的方法,但我不能让它在我的代码中工作.经过多次失败的尝试,我目前有这样的事情:

Can anybody help me out with how to enable a treeview to scroll? There must be a simple way but I can't make it work in my code. After multiple failed tries, I currently have something like this:

<ScrollViewer CanContentScroll="True"> <TreeView ...> </TreeView> </ScrollViewer>

我确实看到了一个禁用"的滚动条,但是当树状视图的注释大于屏幕高度时,不会激活滚动条.

I do see an 'disabled' scrollbar, but when the notes of the treeview are larger than the screen height, no scrolling is activated.

推荐答案

TreeView 控件本身在其模板中包含一个 ScrollViewer.您应该能够在适当的主机中使用 TreeView(而不是 StackPanel!).

The TreeView control itself includes a ScrollViewer in its template. You should be able to just use a TreeView inside an appropriate host (not a StackPanel!).

更多推荐

为 WPF 树视图启用滚动

本文发布于:2023-11-12 20:52:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582506.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视图   WPF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!