Getting Started

This quick guide will help you to install Actions for .NET WinForms library in Visual Studio, and will teach you how to use this library in your projects.


Download a latest version of this library and run setup.exe. This file does not have a digital signature, so Windows may warn you about this (you may safely ignore this warning and proceed with the setup). Setup program will install a following components:

  • Actions.Demo.exe – demo application.
  • – sample project (demo application sources).
  • net20 folder – contains binaries for .NET 2.0.
    • Actions.dll – main class library, which you should reference in your projects.
    • Actions.Design.dll – design library, containing a code of the Actions Editor. You don't need to refer to this library in your projects as it will be used only by Visual Studio WinForms designer.
  • net40 folder – contains binaries for .NET 4.0 (optional).
    • Same files as for .NET 2.0, but compiled using a .NET 4.0 compiler.
  • XML documentation for IntelliSense, readme file and shortcuts.

During the installation, DLL files listed above are registered in a GAC (and unregistered during the uninstallation). This is required to allow Visual Studio to choose a right files for referencing, depending on your project's Target Framework version.

Once installation is completed, you may start Visual Studio and create a new Windows Forms Application project. On a Toolbox window you should see a new category named Actions for WinForms:


In case if something happened and you don’t see this category, or don't see an ActionManager component, you may try to reset your Toolbox (context menu –> Reset Toolbox), or choose the ActionManager manually (context menu –> Choose Items):


On a screenshot above, ActionManager component with a higher revision is for .NET 4.0, and with lower revision is for .NET 2.0. Visual Studio will choose which component to show from these two automatically.

Usage Basics

To learn the basics, we’ll create a minimalist Notepad application. Place the ActionManager component on a designer surface. On a tasks pane click Edit Actions to open the Actions Editor.


Although actions can be created and linked with controls in a source code, Actions Editor is useful to categorize and edit them in WYSIWYG way.


Let’s create some predefined actions. Click New Action –> New Standard Action, select File category and click OK. We don’t need selectFolderAction1 right now, so remove it by pressing a delete key.


Now let’s create some controls to link the actions with. Place ToolStrip control at the top of the form, and create three ToolStripButtons on it. Select a first button, press F4 key to open Properties window and find Action on actionManager1 property. When you choose openFileAction1 in a list, corresponding properties of the tool button will be updated automatically. Now button’s Text, Image, ToolTipText, Enabled and Visible properties are linked with openFileAction1; this means, that if you change some property of the action, corresponding properties of linked controls will be updated as well.


In a same way link the remaining two buttons with saveFileAction1 and exitAction1. You can try to run your application to make sure that buttons are working properly, and, for example, application closes when you click the Exit button.

Tip: It makes sense to set GenerateMember property to false for all of your controls linked with the actions to keep a source code clean, because all major properties of those controls are maintained by the actions and action manager.

Place multiline TextBox on the form, and set it’s Dock property to Fill. We’ll need just a few lines of code to make it act as a Notepad.

In the Properties window select openFileAction1, and create an event handler for the action’s Accept event (note that you can also do this using the Actions Editor). This event occurred when user clicks OK in a file dialog, so that’s a good place to load selected file and display it on the text box:

private void openFileAction1_Accept(object sender, EventArgs e)
   textBox1.Text = File.ReadAllText(openFileAction1.Dialog.FileName);

Handler for saveFileAction1.Accept event will look like this:

private void saveFileAction1_Accept(object sender, EventArgs e)
   File.WriteAllText(saveFileAction1.Dialog.FileName, textBox1.Text);

You can try to add more predefined actions like Undo, Copy and Paste to check how they work. Note, that in order to do this, you don’t need to write even a single line of code.

Asynchronous Actions


Last edited Feb 23, 2013 at 2:26 AM by Raider, version 26


No comments yet.