C# Programming > Miscellaneous

C# ActionList

c# action list

Designer Action Lists

C# controls can be customized with ActionLists. ActionLists were introduced in the .NET Framework 2.0 to make common properties and tasks more accessible for .NET controls during design time.

An ActionList can be added to existing controls or to custom controls, the process is basically the same.

Set the Designer

The first step is to add a reference to System.Design.dll by going to Project > Add Reference...

The process is basically the same because an ActionList is added to a C# control like this:

public partial class ActionButton : Button

In the example, the action list would be added to a button control. The control could easily be a custom user control. Also noteworthy is that the programmer must make the designer class (MyDesigner in the example). This makes sense since we want to specify which properties and methods to expose.


The control designer in this case consists of two main classes. The first one inherits DesignerActionList. This is the class that will have the properties and methods that will appear in the ActionList. By overriding the GetSortedActionItems function programmers can specify the categories and text of all the properties. The best part is the designer will automatically use the appropriate editor for the different types of properties.


The second main class inherits ControlDesigner. This class is MyDesigner from the example above. There is not much to this class, we basically just need to link the DesignerActionList class to it. This is done by overriding the ActionLists property.

Once that is done the ControlDesigner class is applied to the control exactly as the code shows above.


Take a look at the source code that can be downloaded at bottom of the page. The program uses the exact code described in the article. Remember that ActionLists in C# are for design-time purposes, there is nothing to see during run-time.

Action lists are also refered to as smart tags.

Back to C# Article List