Sometimes ago , Ive been looking for a method to expand a TreeView to a specific node in WPF.
I couldn't find anything useful and eventually I have written my own :
void JumpToNode(TreeViewItem tvi, string NodeName)
{
if (tvi.Name == NodeName)
{
tvi.IsExpanded = true;
tvi.BringIntoView();
return;
}
else
tvi.IsExpanded = false;
if (tvi.HasItems)
{
foreach (var item in tvi.Items)
{
TreeViewItem temp = item as TreeViewItem;
JumpToNode(temp, NodeName);
}
}
}