I'm trying to keep the scroll position of TreeView
control even when an item is inserted.
ItemsSource
in the TreeView
is set by code and it shows items using DataTemplate
.
When I insert an item to the data source at 0, the TreeView
will automatically scroll up by the height of the new item.
Actually this feature is useful when scroll-position is at the top, but even if not it scrolls up.
(I'm using TreeView
for Virtualizing items with CanContentScroll
set to false
.)
How can I prevent this default behavior?
WPF 4.0 / C# - Visual Studio 2010 on Windows 7