i was breaking my head with this, i will explain i have a treeview and i need to find a node, i have the node's id, but i want to save the trace of the node in a list
e.g. if i want to find node 1.2.1.1
node1
node1.1
node 1.1.1
node 1.1.2
node 1.1.3
node 1.2
node 1.2.1
node 1.2.1.1
node 1.3
my list should have {node1,node1.2,node1.2.1,node 1.2.1.1}
i made some code but it is not working please help! i will be very thankful
this is my code
foreach (SFFolder item in folderBrowserTreeView.Items)
{
JumpToNode(item, recoveryFolderID);
}
void JumpToNode(SFFolder tvi, string folderID)
{
if (tvi.Id == folderID)
{
folderBrowserTreeView.Focus();
tvi.IsExpanded = true;
tvi.IsSelected = true;
return;
}
else
tvi.IsExpanded = true;
if (tvi.HasChildren)
{
tvi.Childrens = _apiShareMethods.GetChildrens(_token, tvi.Id);//this add new children from the rest api
foreach (var item in tvi.Childrens)
{
SFFolder temp = item as SFFolder;
JumpToNode(temp, folderID, localPath);
}
}
this code expand all the nodes before found the node that i am trying to found, and what i want is just expand the path of the wanted node