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