The Tricks with TreeViewItem Expansion

|

As I promised in MSDN WPF forum ages ago, I will post the tricks I learnt when playing with TreeView and TreeViewItems, so here comes the source. I have put slightly detailed explanation(those texts in green colour) on the demo Window, you can see it in the following screenshot:

If you look at the source code, you will find that I use the WpfApplication helper class to implement the DoEvents logic in WPF, I've posted how I do this ages ago, you can find the original article here.

1 comments:

Carlos de Luna Saenz said...

I have a XBAP/WPF application ant the code works OK for expanding / shrinking the nodes of a tree view, but i have troubles with the selection code... since the items are changed via programatically some how the ItemsGenerator doesn't returns me the TreeViewItem of the node that reaches the selection condition... it brings me a null value... what's more, if i change the value on your program to Foler 1.2.2.1 the program got an unhandled exception...
SelectNodeUsingItemContainerGenerator(path.ToArray(), 3, treeView);