Class CheckBoxField
Represents a checkbox form field in the SfPdfViewer2 component.
Inherited Members
Namespace: Syncfusion.Blazor.SfPdfViewer
Assembly: Syncfusion.Blazor.SfPdfViewer.dll
Syntax
public class CheckBoxField : FormFieldInfo
Remarks
Initializes a new instance of the CheckBoxField class with the default field type set to "CheckBox."
This field allows users to select or deselect an option in interactive PDF forms.
Examples
CheckBoxField checkBoxField = new CheckBoxField();
checkBoxField.Name = "AcceptTerms";
checkBoxField.IsChecked = true; // Marks the checkbox as selected.
await viewer.AddFormFieldsAsync(new List<FormFieldInfo> { checkBoxField });
Constructors
CheckBoxField()
Initializes a new instance of the CheckBoxField class in the SfPdfViewer2 component.
Declaration
public CheckBoxField()
Remarks
This constructor creates a checkbox field with the default field type set to "CheckBox."
Checkbox fields allow users to select or deselect an option in interactive PDF forms.
Examples
CheckBoxField checkBoxField = new CheckBoxField();
checkBoxField.Name = "AcceptTerms";
checkBoxField.IsChecked = true; // Marks the checkbox as selected.
await viewer.AddFormFieldsAsync(new List<FormFieldInfo> { checkBoxField });
Properties
IsChecked
Gets or sets the checked state of the CheckBoxField in the SfPdfViewer2 component.
Declaration
public bool IsChecked { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A System.Boolean representing the checked state of the CheckBoxField. |
Remarks
Represents whether the checkbox field is selected or not in the CheckBoxField.
Changing this property updates the checked state in the corresponding PDF form field.
This property allows programmatic control over the selection of the checkbox.
Examples
CheckBoxField checkBoxField = new CheckBoxField();
checkBoxField.IsChecked = true; // Marks the checkbox as selected.
Value
Gets or sets the value associated with the CheckBoxField in the SfPdfViewer2 component.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String | A System.String representing the value assigned to the checkbox field. |
Remarks
The Value property represents the data assigned to the checkbox field when it is selected.
This value typically corresponds to a predefined option or user-defined text that indicates the checked state of the checkbox.
When the checkbox is unchecked, the value will be empty or set to the default unselected state.
Examples
The following example demonstrates how to assign a value to the checkbox field:
CheckBoxField checkBoxField = new CheckBoxField();
checkBoxField.Value = "Accepted";