In WinForms, I used to catch BeforeExpand event of tree view and add additional items on the fly, from database (or any other source of course). So was looking to do the same thing in WPF TreeView and somehow missed the Expanded event of TreeViewItem. You can subscribe to this event in XAML like this:
<TreeView TreeViewItem.Expanded="TreeView_Expanded"></TreeView>
The rest of code is pretty simple, but if you want to see a full example, look at this post in MSDN forums: Loading TreeView nodes on demand.
Technorati Tags:
WPF,
.NET
posted @ Wednesday, September 05, 2007 6:59 AM