New to Telerik Document ProcessingStart a free 30-day trial

Action Collections

Updated on Nov 3, 2025

Depending on the document element associated with the actions, there are different collection types that store the actions providing the appropriate public API.

ActionCollection

Represents a basic collection of Action objects. The collection allows manipulating the items by the following public methods:

Method NameDescription
AddAdds the specified Action to the end of the collection.
AddRangeAdds the elements of the specified collection to the end of the current collection.
InsertInserts an Action into the collection at the specified index.
ClearRemoves all elements from the collection.
RemoveRemoves the first occurrence of a specific Action from the collection.
RemoveRangeRemoves a range of elements from the collection.
RemoveAtRemoves the element at the specified index of the collection.
FindFinds the first Action that matches the conditions defined by the specified predicate.
FindAllFinds all Action objects that match the conditions defined by the specified predicate.
ReverseReverses the order of the elements in the collection.
GetRangeReturns a range of elements from the collection.

AnnotationActionCollection

An abstract class that represents a collection of Action objects. It is the base class for the WidgetActionCollection exposing the following API:

Property NameDescription
MouseEnterGets the collection of actions triggered when the mouse enters the annotation area.
MouseExitGets the collection of actions triggered when the mouse exits the annotation area.
MouseDownGets the collection of actions triggered when the mouse button is pressed within the annotation area.
MouseUpGets the collection of actions triggered when the mouse button is released within the annotation area.

WidgetActionCollection

Represents a collection of Action objects, specifically for widget annotations.

Property NameDescription
OnFocusGets or sets the collection of actions triggered when the widget gains the input focus.
OnBlurGets or sets the collection of actions triggered when the widget loses the input focus.
OnPageOpenGets or sets the collection of actions triggered when the page containing the widget is opened.
OnPageCloseGets or sets the collection of actions triggered when the page containing the widget is closed.
OnPageVisibleGets or sets the collection of actions triggered when the page containing the widget becomes visible.
OnPageInvisibleGets or sets the collection of actions triggered when the page containing the widget becomes invisible.

FormFieldActionCollection

Represents a collection of JavaScriptAction objects associated with a FormField.

Property NameDescription
KeystrokeGets or sets the JavaScript action to be performed when the user types a keystroke into a text field or combo box or modifies the selection in a scrollable list box.
FormatGets or sets the JavaScript action to be performed before the field is formatted to display its current value.
ValidateGets or sets the JavaScript action to be performed when the field’s value is changed.
CalculateGets or sets the JavaScript action to be performed to recalculate the value of this field when that of another field changes.

It is suitable for cases when a certain calculation needs to be performed after entering user values. A sample approach is demonstrated in the Multiplying TextBoxField Values with JavaScript Actions article.

A common case is restricting the user's input, e.g. when entering a date in a specific format:

c#
RadFixedDocument document = new RadFixedDocument();
document.Pages.AddPage();

TextBoxField textField = new TextBoxField("SampleTextBox");
textField.Actions.Format =
    new Telerik.Windows.Documents.Fixed.Model.Actions.JavaScriptAction("AFDate_FormatEx(\"m/d/yy\");");
textField.Actions.Keystroke =
    new Telerik.Windows.Documents.Fixed.Model.Actions.JavaScriptAction("AFDate_KeystrokeEx(\"m/d/yy\");");

VariableContentWidget widget = textField.Widgets.AddWidget();
widget.Rect = new Rect(0, 0,250, 50);

document.AcroForm.FormFields.Add(textField);
document.Pages[0].Annotations.Add(widget);

The achieved result is illustrated below:

JS Action Format FormField

PageActionCollection

Represents a collection of Action objects associated with a RadFixedPage.

Property NameDescription
OnPageOpenGets or sets the collection of actions triggered when the page is opened.
OnPageCloseGets or sets the collection of actions triggered when the page is closed.

The following example shows how to utilize the JavaScript Actions functionality showing an alert when the second page in a document is closed:

c#
RadFixedDocument document = new RadFixedDocument();
document.Pages.AddPage(); //first page
RadFixedPage page = document.Pages.AddPage(); //second page
JavaScriptAction action = new JavaScriptAction("app.alert('JS Action when second page is closed!');");
page.Actions.OnPageClose.Add(action);
document.Pages.AddPage(); //third page

JS Action Page

DocumentActionCollection

Represents a collection of JavaScriptAction objects associated with RadFixedDocument.

Property NameDescription
DocumentWillCloseGets or sets the JavaScript action that will be triggered before the document is closed.
DocumentWillSaveGets or sets the JavaScript action that will be triggered before the document is saved.
DocumentDidSaveGets or sets the JavaScript action that will be triggered after the document is saved.
DocumentWillPrintGets or sets the JavaScript action that will be triggered before the document is printed.
DocumentDidPrintGets or sets the JavaScript action that will be triggered after the document is printed.

See Also