Pogramatically Find TreeView Item in C#


This blog gives a code example how to find and focus TreeView item at run time using c#, see the following code, you will come to your know the logic

foreach (object obje in this.filterableTreeview.Items)


      TreeViewItem TVI = (TreeViewItem)filterableTreeview.ItemContainerGenerator.ContainerFromItem(obje);

      if (TVI.Header.ToString().ToLower() == this.txtsearch.Text.ToLower())


    TVI.Background = Brushes.Red;

    TVI.IsExpanded = true;


    if (TVI.Items.Count > 0)