Instruction Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WPF. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WPF. SDK TXTextControl.from the setup.dll
- Implements
- IComparable
Description
An object of the Instruction class is an element of the ConditionalInstruction class and represents actions that are execute´d when the corresponding conditions are fulfilled.
To specify such an instruction, the Instruction object has to be initialized with a FormField that is located inside the document. That form field is the object for which the desired actions are executed.
In this context, up to four different types of actions can be executed: Changing the FormField.Enabled property, marking the form field value as valid or invalid, setting a new value and replacing the SelectionFormField.Items array with another string array. On invoking an instance of the Instruction class, one of these types has to be set to the instructionType parameter by using one of the corresponding Instruction.InstructionTypes enumeration values.
To specify a value that is set by the specified action when the defined requirements of the ConditionalInstruction.Conditions array are fulfilled, the constructor's instructionValue parameter must be used. A value that is applied when the corresponding conditions are not fulfilled, can be set by the elseInstructionValue parameter of the constructor's second overload.
Syntax
public class Instruction : IComparablePublic Class Instruction
Implements IComparableExamples
The following example builds a rule around an approval check box in a fillable form.
CheckFormField approvalField = new(false) { Name = "Approved" };
textControl.FormFields.Add(approvalField);
Instruction instruction = new(approvalField, Instruction.InstructionTypes.IsEnabled, true);Dim approvalField As New CheckFormField(False) With { .Name = "Approved" }
textControl.FormFields.Add(approvalField)
Dim instruction As New Instruction(approvalField, Instruction.InstructionTypes.IsEnabled, True)Members
Constructors
| Constructor | Description |
|---|---|
| Instruction | Initializes a new instance of the Instruction class to determine an action that is executed when the defined requirements of the ConditionalInstruction.Conditions array are fulfilled or not fulfilled. |
Properties
| Property | Description |
|---|---|
| ElseInstructionValue | Gets the value that is set by the specified action when the defined requirements of the ConditionalInstruction.Conditions array are not fulfilled and the Instruction.IsElseInstructionEnabled property is set to true. |
| FormField | Gets the FormField to which the specified action is executed. |
| InstructionType | Gets the type of action to execute. It specifies how the instruction value and else instruction value is applied to the corresponding form field. |
| InstructionValue | Gets the value that is set by the specified action when the defined requirements of the ConditionalInstruction.Conditions array are fulfilled. |
| IsElseInstructionEnabled | Gets or sets a value indicating whether this Instruction allows to execute else instructions. If this property is set to true, the else instruction value is applied by the specified action when the defined requirements of the ConditionalInstruction.Conditions array are not fulfilled. The default value is false, if no else instruction value was set by the instruction constructor. Otherwise true. |
| IsFormFieldChangeInstruction | Gets or sets a value indicating whether this Instruction listens to value changes of the related conditions' form fields. If this property is set to false, the instruction ignores any form field change that would cause an action. Otherwise the corresponding actions are executed. The default value is true. |
| IsInitialInstruction | Gets or sets a value indicating whether this Instruction is handled when the document is initialized as a form. By default, all conditional instructions are applied when the document is changed to or loaded as a form. In this context, if this property is set to false, the instruction does not execute any actions, even if the requirements are fulfilled. The default value is true. |
Methods
| Method | Description |
|---|---|
| CompareTo | Not described in the reference. public int CompareTo(object obj); |
Enumerations
| Enumeration | Description |
|---|---|
| InstructionTypes | Determines the type of action to execute. The enumeration contains the following values: |