Prevent Automatic Horizontal Scroll On Selected TreeView Item
When a TreeViewItem is selected, the horizontal and vertical scrollbars adjust so it开发者_开发技巧's in view. I like the vertical scrollbar behavior, but I want to stop the horizontal one. Disabling the horizontal scrollbar has no effect.
Try using the ScrollViewer.HorizontalScrollBarVisability and setting it to Disabled.
<TreeView Width="100" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<TreeViewItem Header="This is a very long header with a small width..................123"/>
</TreeView>
This may guide you ...
Key is to handle BringIntoView event at tree view item level before scrollviewer receives it.
精彩评论