开发者

WPF treeview - How do i know when a treeviewitem was added to the treeview?

开发者 https://www.devze.com 2022-12-14 16:10 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消