New to Telerik Document ProcessingStart a free 30-day trial

Action Collections

Updated on Jun 3, 2026

Depending on the document element associated with the actions, different collection types store the actions and provide the appropriate public API.

ActionCollection

Represents a basic collection of Action objects. The collection allows you to manipulate items through 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 and exposes 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 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 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 performed before the field is formatted to display its current value.
ValidateGets or sets the JavaScript action performed when the field value is changed.
CalculateGets or sets the JavaScript action performed to recalculate the value of this field when another field changes.

Use this collection when a calculation must run after the user enters values. A sample approach is demonstrated in the Multiplying TextBoxField Values with JavaScript Actions article.

A common case is restricting the user input, for example, 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 following image shows the result:

JS Action Format FormField result showing date format validation

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 use the JavaScript Actions feature to show 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 result showing an alert on page close

DocumentActionCollection

Represents a collection of JavaScriptAction objects associated with RadFixedDocument.

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

See Also