When you try to expand selected node in treeview control dynamically, just use the following code:
// get selected node
TreeNode parentNode = tvItems.SelectedNode;
// get top parent node
while(parentNode.Parent != null)
{
parentNode = parentNode.Parent;
}
// find node by value path, then expand it
tvItems.FindNode(parentNode.ValuePath).ExpandAll();
// get selected node
TreeNode parentNode = tvItems.SelectedNode;
// get top parent node
while(parentNode.Parent != null)
{
parentNode = parentNode.Parent;
}
// find node by value path, then expand it
tvItems.FindNode(parentNode.ValuePath).ExpandAll();