Design pattern to encapsulate common funtionality among UI controls

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-06-07T15:13:12Z Indexed on 2010/06/07 15:22 UTC
Read the original article Hit count: 222

Filed under:
|

I'm brainstorming some ideas around a pattern to use for the following scenario.

I have some 3rd party controls that I want to add common functionality to. Functionality is added by handling several of the the events and doing certain things when the events fire along with adding some private variables to hold some state info between events. I want to reuse the code and functionality so this is what I'd typically do.

Create a class for this functionality and pass in the instance of the control that I want to add the functionality to in the constructor.

Then I can add event handlers to the control in the instance of the class.

Can anyone think of alternative patterns to use in order to create this kind of reusable functionality.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about design-patterns