# Condition Constructor

> Initializes a new instance of the Condition class.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Constructor
- **Introduced:** 28.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > Condition Constructor
- **4972 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/constructor/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/constructor/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/constructor/llms-full.txt

---

### Description

Initializes a new instance of the Condition class.

### Syntax

#### Condition(CheckFormField, bool)

Creates an instance of the Condition class that tests whether the [CheckFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/checkformfield/llms-full.txt)'s [Checked](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/checkformfield/checked-property/llms-full.txt) property value equals the specified boolean value. The [Condition.ComparisonValueType](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvaluetype-property/llms-full.txt) property is set to `ComparisonValueTypes.CheckState`.

```csharp
public Condition(CheckFormField formField, bool isChecked);
```

```vbnet
Public Sub New(formField As CheckFormField, isChecked As Boolean)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/formfield-property/llms-full.txt) whose property value is to be compared with the condition's comparison value. |
| isChecked | Specifies the value that the `CheckFormField.Checked` property must have to fulfill the condition. |

#### Condition(TextFormField, Condition.ComparisonOperators, string)

Creates an instance of the Condition class that compares the [TextFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textformfield/llms-full.txt)'s [Text](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textfield/text-property/llms-full.txt) property with the specified string value. If that value is null or an empty string, the condition's comparison value is interpreted as `ComparisonValueTypes.NoValue`. Otherwise as `ComparisonValueTypes.CustomText`.

```csharp
public Condition(TextFormField formField, Condition.ComparisonOperators comparisonOperator, string comparisonValue);
```

```vbnet
Public Sub New(formField As TextFormField, comparisonOperator As Condition.ComparisonOperators, comparisonValue As String)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/formfield-property/llms-full.txt) whose property value is to be compared with the condition's comparison value. |
| comparisonOperator | Specifies the [operator](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonoperator-property/llms-full.txt) that is used to compare the condition's form field value with the specified comparison value. |
| comparisonValue | Specifies the [value](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvalue-property/llms-full.txt) that is compared with the condition's form field value. |

#### Condition(TextFormField, Condition.ComparisonOperators, string, Condition.TextComparisonFlags)

Creates an instance of the Condition class that compares the [TextFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textformfield/llms-full.txt)'s [Text](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textfield/text-property/llms-full.txt) property with the specified string value. The `textComparisonFlag` parameter determines whether the comparison value is interpreted as `ComparisonValueTypes.CustomText` or `ComparisonValueTypes.Regex`. If the `comparisonValue` parameter is null or an empty string, a `System.ArgumentException` is thrown.

```csharp
public Condition(TextFormField formField, Condition.ComparisonOperators comparisonOperator, string comparisonValue, Condition.TextComparisonFlags textComparisonFlag);
```

```vbnet
Public Sub New(formField As TextFormField, comparisonOperator As Condition.ComparisonOperators, comparisonValue As String, textComparisonFlag As Condition.TextComparisonFlags)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/formfield-property/llms-full.txt) whose property value is to be compared with the condition's comparison value. |
| comparisonOperator | Specifies the [operator](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonoperator-property/llms-full.txt) that is used to compare the condition's form field value with the specified comparison value. |
| comparisonValue | Specifies the [value](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvalue-property/llms-full.txt) that is compared with the condition's form field value. |
| textComparisonFlag | Determines whether the comparison value is [interpreted](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvaluetype-property/llms-full.txt) as `ComparisonValueTypes.CustomText` or `ComparisonValueTypes.Regex`. |

#### Condition(SelectionFormField, Condition.ComparisonOperators, string)

Creates an instance of the Condition class that compares the [SelectionFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selectionformfield/llms-full.txt)'s [Text](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textfield/text-property/llms-full.txt) property with the specified string value. If that value is null or an empty string, the condition's comparison value is interpreted as `ComparisonValueTypes.NoValue`.

```csharp
public Condition(SelectionFormField formField, Condition.ComparisonOperators comparisonOperator, string comparisonValue);
```

```vbnet
Public Sub New(formField As SelectionFormField, comparisonOperator As Condition.ComparisonOperators, comparisonValue As String)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/formfield-property/llms-full.txt) whose property value is to be compared with the condition's comparison value. |
| comparisonOperator | Specifies the [operator](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonoperator-property/llms-full.txt) that is used to compare the condition's form field value with the specified comparison value. |
| comparisonValue | Specifies the [value](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvalue-property/llms-full.txt) that is compared with the condition's form field value. |

#### Condition(SelectionFormField, Condition.ComparisonOperators, string, Condition.TextComparisonFlags)

Creates an instance of the Condition class that compares the [SelectionFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selectionformfield/llms-full.txt)'s [Text](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textfield/text-property/llms-full.txt) property with the specified string value. The `textComparisonFlag` parameter determines whether the comparison value is interpreted as `ComparisonValueTypes.CustomText` or `ComparisonValueTypes.Regex`. If the `comparisonValue` parameter is null or an empty string, a `System.ArgumentException` is thrown.

```csharp
public Condition(SelectionFormField formField, Condition.ComparisonOperators comparisonOperator, string comparisonValue, Condition.TextComparisonFlags textComparisonFlag);
```

```vbnet
Public Sub New(formField As SelectionFormField, comparisonOperator As Condition.ComparisonOperators, comparisonValue As String, textComparisonFlag As Condition.TextComparisonFlags)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/formfield-property/llms-full.txt) whose property value is to be compared with the condition's comparison value. |
| comparisonOperator | Specifies the [operator](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonoperator-property/llms-full.txt) that is used to compare the condition's form field value with the specified comparison value. |
| comparisonValue | Specifies the [value](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvalue-property/llms-full.txt) that is compared with the condition's form field value. |
| textComparisonFlag | Determines whether the comparison value is [interpreted](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvaluetype-property/llms-full.txt) as `ComparisonValueTypes.CustomText` or `ComparisonValueTypes.Regex`. |

#### Condition(SelectionFormField, Condition.ComparisonOperators, string, Condition.ItemComparisonFlags)

Creates an instance of the Condition class that compares the [SelectionFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selectionformfield/llms-full.txt)'s [Text](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textfield/text-property/llms-full.txt) property with the specified string value. The `itemComparisonFlag` parameter determines whether the comparison value is interpreted as `ComparisonValueTypes.AnyItem` or `ComparisonValueTypes.SpecificItem`. If the `itemComparisonFlag` parameter is set to `ItemComparisonFlags.SpecificItem` and the `comparisonValue` parameter is null, an empty string or not an element of the [SelectionFormField.Items](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selectionformfield/items-property/llms-full.txt) collection, a `System.ArgumentException` is thrown.

```csharp
public Condition(SelectionFormField formField, Condition.ComparisonOperators comparisonOperator, string comparisonValue, Condition.ItemComparisonFlags itemComparisonFlag);
```

```vbnet
Public Sub New(formField As SelectionFormField, comparisonOperator As Condition.ComparisonOperators, comparisonValue As String, itemComparisonFlag As Condition.ItemComparisonFlags)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/formfield-property/llms-full.txt) whose property value is to be compared with the condition's comparison value. |
| comparisonOperator | Specifies the [operator](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonoperator-property/llms-full.txt) that is used to compare the condition's form field value with the specified comparison value. |
| comparisonValue | Specifies the [value](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvalue-property/llms-full.txt) that is compared with the condition's form field value. |
| itemComparisonFlag | Determines whether the comparison value is [interpreted](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvaluetype-property/llms-full.txt) as `ComparisonValueTypes.AnyItem` or `ComparisonValueTypes.SpecificItem`. |

#### Condition(DateFormField, Condition.ComparisonOperators, DateTime?)

Creates an instance of the Condition class that compares the [DateFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/dateformfield/llms-full.txt)'s [Date](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/dateformfield/date-property/llms-full.txt) property with the specified `System.DateTime` value. If that value is null, the condition's comparison value is interpreted as `ComparisonValueTypes.NoValue`. Otherwise as `ComparisonValueTypes.Date`.

```csharp
public Condition(DateFormField formField, Condition.ComparisonOperators comparisonOperator, DateTime? comparisonValue);
```

```vbnet
Public Sub New(formField As DateFormField, comparisonOperator As Condition.ComparisonOperators, comparisonValue As DateTime?)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/formfield-property/llms-full.txt) whose property value is to be compared with the condition's comparison value. |
| comparisonOperator | Specifies the [operator](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonoperator-property/llms-full.txt) that is used to compare the condition's form field value with the specified comparison value. |
| comparisonValue | Specifies the [value](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvalue-property/llms-full.txt) that is compared with the condition's form field value. |

#### Condition(DateFormField, Condition.ComparisonOperators, int)

Creates an instance of the Condition class that compares the [DateFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/dateformfield/llms-full.txt)'s [Date](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/dateformfield/date-property/llms-full.txt) property with the specified integer value. If that value is greater than 1600 and less than 10000, the condition's comparison value is interpreted as `ComparisonValueTypes.Year`. If the value is a positive number between 1 and 31, the comparison value is interpreted as `ComparisonValueTypes.DayOfMonth`. For all other integer values a `System.ArgumentException` is thrown.

```csharp
public Condition(DateFormField formField, Condition.ComparisonOperators comparisonOperator, int comparisonValue);
```

```vbnet
Public Sub New(formField As DateFormField, comparisonOperator As Condition.ComparisonOperators, comparisonValue As Integer)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/formfield-property/llms-full.txt) whose property value is to be compared with the condition's comparison value. |
| comparisonOperator | Specifies the [operator](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonoperator-property/llms-full.txt) that is used to compare the condition's form field value with the specified comparison value. |
| comparisonValue | Specifies the [value](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvalue-property/llms-full.txt) that is compared with the condition's form field value. |

#### Condition(DateFormField, Condition.ComparisonOperators, Condition.Month)

Creates an instance of the Condition class that compares the [DateFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/dateformfield/llms-full.txt)'s [Date](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/dateformfield/date-property/llms-full.txt) property with the specified [Condition.Month](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/month-enumeration/llms-full.txt) value. That condition's comparison value is interpreted as `ComparisonValueTypes.Month`.

```csharp
public Condition(DateFormField formField, Condition.ComparisonOperators comparisonOperator, Condition.Month comparisonValue);
```

```vbnet
Public Sub New(formField As DateFormField, comparisonOperator As Condition.ComparisonOperators, comparisonValue As Condition.Month)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/formfield-property/llms-full.txt) whose property value is to be compared with the condition's comparison value. |
| comparisonOperator | Specifies the [operator](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonoperator-property/llms-full.txt) that is used to compare the condition's form field value with the specified comparison value. |
| comparisonValue | Specifies the [value](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvalue-property/llms-full.txt) that is compared with the condition's form field value. |

#### Condition(DateFormField, Condition.ComparisonOperators, DayOfWeek)

Creates an instance of the Condition class that compares the [DateFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/dateformfield/llms-full.txt)'s [Date](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/dateformfield/date-property/llms-full.txt) property with the specified `System.DayOfWeek` value. That condition's comparison value is interpreted as `ComparisonValueTypes.Weekday`.

```csharp
public Condition(DateFormField formField, Condition.ComparisonOperators comparisonOperator, DayOfWeek comparisonValue);
```

```vbnet
Public Sub New(formField As DateFormField, comparisonOperator As Condition.ComparisonOperators, comparisonValue As DayOfWeek)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/formfield-property/llms-full.txt) whose property value is to be compared with the condition's comparison value. |
| comparisonOperator | Specifies the [operator](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonoperator-property/llms-full.txt) that is used to compare the condition's form field value with the specified comparison value. |
| comparisonValue | Specifies the [value](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvalue-property/llms-full.txt) that is compared with the condition's form field value. |

### Examples

The following example creates a Condition instance and configures its logical connective setting for a document workflow.

```csharp
Condition condition = new(new TXTextControl.CheckFormField(true), true);
condition.LogicalConnective = Condition.LogicalConnectives.And;
```

```vbnet
Dim condition As New Condition(New TXTextControl.CheckFormField(True), True)
condition.LogicalConnective = Condition.LogicalConnectives.And
```

---

## Nearby

- **Previous:** [Condition.ComparisonValueTypes Enumeration](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/comparisonvaluetypes-enumeration/llms-full.txt)
- **Next:** [Condition.FormField Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/condition/formfield-property/llms-full.txt)
