WPF treeview - How do i know when a treeviewitem was added to the treeview?
I have a treeview which is bound to an observablecollection via HierarchicalDataTemplate. I cant seem to find any treeview functionality that provides me notifications that at any level a new treeviewitem was added.
I know that i can bubble item addition notification to my model's root and raise property changes 开发者_开发百科which can be handled, but I'm trying to find a way doing so by my view without adding this functionality to the model/view-model.
Thanks, Oren.
You are already using an Observable Collection, which notifies when the collection is changed - so hook into this event rather than into the treeview, which is also an observer of the same collection.
精彩评论