Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 防止在所选树视图项目上自动水平滚动_C#_Wpf - Fatal编程技术网

C# 防止在所选树视图项目上自动水平滚动

C# 防止在所选树视图项目上自动水平滚动,c#,wpf,C#,Wpf,选择TreeView项目时,水平和垂直滚动条会进行调整,使其处于视图中。我喜欢垂直滚动条的行为,但我想停止水平滚动条。禁用水平滚动条无效。尝试使用ScrollViewer.HorizontalScrollBarVisibility并将其设置为禁用 <TreeView Width="100" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> <TreeViewItem Header="This is a

选择TreeView项目时,水平和垂直滚动条会进行调整,使其处于视图中。我喜欢垂直滚动条的行为,但我想停止水平滚动条。禁用水平滚动条无效。

尝试使用ScrollViewer.HorizontalScrollBarVisibility并将其设置为禁用

<TreeView Width="100" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
        <TreeViewItem Header="This is a very long header with a small width..................123"/>
    </TreeView>

可以指导您

关键是在scrollviewer接收到BringIntoView事件之前,在树状视图项级别处理它