TreeView Issue with expanding non-selected item TreeView Issue with expanding non-selected item wpf wpf

TreeView Issue with expanding non-selected item


The issue is related to the logical scope concept called FocusScope.

What you want is to set IsFocusScope for your TreeView to true:

<TreeView Width="500" Height="500" Name="TestTreeView" FocusManager.IsFocusScope="true"></TreeView>

Here is an article about it http://www.codeproject.com/Articles/38507/Using-the-WPF-FocusScope

Here is the .net 4.5 doc for it: http://msdn.microsoft.com/en-us/library/aa969768.aspxAs it explains it better than I can and which may be more up to date then the codeproject article