I did post about this few days ago… but I made a big mistake!!!. Fortunately my post was online for 8 hours or so.
What I was wondering is how to create new items in a WPF Treeview that has been created using a HierarchicalDataTemplate with a collection of objects bound to it (ItemsSource={Binding} + DataContext), rather than using TreeViewItem objects programmatically. Becase if you have your treeview populated from C# using TreeViewItem objects then you can use the Header property to store the object itself and the Items property to append child objects but… how do you do otherwise?.
The solution is the ObservableCollection<T> class. I created a class containing a Parent property to keep track of the upper levels and an Items property which is an ObservableCollection. The I can access the selected object by casting the treeview.SelectedItem property and I can delete or add nodes to the Items collection so that the treeview gets refreshed.