Sunday, March 24, 2019

WPF: Custom Items Control - How to add logic before an item is removed ?

Hi there,

I'm writing a custom tree view and just before an item is removed, I need to set a property on the corresponding item container to false (for multi-selection). My logic requires the item to still be connected to the items control. I essentially need to talk to every item just before they get removed.

Since it's a tree, I need to do this recursively all the way down. For any tree item that is removed and has children... I need to unselect all their children too.

There's a nifty overridable function called ClearContainerForItemOverride where a custom control writer could do some work on the item container after removal, but I need to do work on the item container JUST BEFORE REMOVAL.

Is this possible?

If not, I suppose I could do something at the view-model side extend ObsColl and do some stuff everytime remove is called. But I'd prefer not to do that.

Best,

Nick

WPF: Custom Items Control - How to add logic before an item is removed ? Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team