[WPF][MVVM] TreeView: Scroll To Selected Item

0
Comments

Here is the MVVM way to bring selected TreeViewItem into a view. First we need an attached behavior. We cannot use regular behavior because we will attach this property through Style. public class BringSelectedItemIntoViewBehavior { public static readonly DependencyProperty IsBringSelectedIntoViewProperty = DependencyProperty.RegisterAttached( "IsBringSelectedIntoView", typeof (bool), typeof (BringSelectedItemIntoViewBehavior), new PropertyMetadata(default(bool), PropertyChangedCallbac...

Read further...