Prevent Automatic Horizontal Scroll in TreeView

前端 未结 8 967
伪装坚强ぢ
伪装坚强ぢ 2020-12-14 06:41

Whenever a node is selected in my treeview, it automatically does a horizontal scroll to that item. Is there a way to disable this?

8条回答
  •  萌比男神i
    2020-12-14 07:19

    Following solution is more simple and fully tested and more compatible, You don't need to calculate and change scrollbar offset, what you need is moving horizontal scrollbar to left, since "RequestBringIntoView" event routing strategy is bubbling, you simply need to do it on last item reached event. Name scrollViewer control "_tv_scrollviewer_"