I am creating a class that comes from a WPF RichTextBox control, and I need to execute some code in copy and paste events.
I understand that, when possible, it is best to implement event-based code in a derived class by overriding the base class method that raises the event. However, in this case, such a method does not exist, and is it acceptable for my derived class to add an event handler to its own base class events?
If I add an event handler, I assume that it should be explicitly deleted when the control is removed. However, I'm not sure how best to do this in the case of the RichTextBox , as the WPF management classes do not seem to have any mechanism for detecting deletion.
Any suggestions please?
Thanks Tim
source share