Wisej.NET
Ask or search…
K

Extenders

Extenders are components that add, and manage for, properties to other components.
Since it's impossible to add properties to another class or object, the properties added by an extender only look like properties in the designer. At runtime they are simple Set/Get methods on the extender itself.
An extender must implements the IExtenderProvider interface allowing it to decide whether a specific component can be extended (at design time) through the CanExtend(component) implementation.
Some extender are not even a separate component. For example, the TableLayoutPanel, FlexLayoutPanel and FlowLayoutPanel are all extenders and add properties to their children. This feature is extremely powerful in a web system, when you drop a control inside a FlexLayoutPanel, that control "gains" new properties such as FillWeight, AlignX, AlignY, etc. These are properties that make sense only when the target control is inside a FlexLayoutPanel.
Other extenders are not controls and do not have a UI. They add features to the control they extend. See the Animation, ToolTip and similar extenders.
You can add multiple instances of the same extender. If you add two (or 10) Animation extenders you will be able to define multiple animations for each control in response to different events.

IExtenderProvider

The System.ComponentModel.IExtenderProvider is part of the System.ComponentModel infrastructure in .NET. It requires only one method to be implemented:

bool CanExtend(object target)

Return true if the extender wants to extend the target object. There isn't anything more to it and there Microsoft documentation and examples are quite exhaustive.

ProvidePropertyAttribute

An extender class indicates which property wants to add by specifying one or more ProvidePropertyAttribute declarations.

IWisejExtenderProvider