When you have a TableLayoutPanel on your Form and you drag a Label into a cell, a few properties are available on the Label control. I think the same construction is used when you drag a Tooltip control on the form.
I’d like to know which design pattern is used to achieve this. Is this the decorator pattern?
What you are seeing are called Extender Providers.
I can’t think of a well-known pattern that describes how they work, exactly, but the mechanism is simple.
You must implement
IExtenderProvider. The WinForms Designer will callCanExtendfor each other control on the surface, and your extender can specify if it provides additional attributes for each control.The actual attributes that other controls will be extended are declared using the
ProvidePropertyAttributeand a method to provide the value.