Class PdfListField
Represents base class for form's list fields.
Inheritance
System.Object
PdfListField
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public abstract class PdfListField : PdfAppearanceField, IPdfWrapper, INotifyPropertyChanged
Constructors
PdfListField(PdfPageBase, String)
Initializes a new instance of the PdfListField class with the specific page and name.
Declaration
public PdfListField(PdfPageBase page, string name)
Parameters
Type | Name | Description |
---|---|---|
PdfPageBase | page | Page which the field to be placed on. |
System.String | name | The name of the field. |
Properties
Items
Gets the list field items.[Read-Only]
Declaration
public PdfListFieldItemCollection Items { get; }
Property Value
Type | Description |
---|---|
PdfListFieldItemCollection | The items. |
Examples
//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create list box
PdfListBoxField listBox = new PdfListBoxField(page, "list1");
//Add the field to listbox.
document.Form.Fields.Add(listBox);
//Set the properties.
listBox.Bounds = new RectangleF(100, 350, 100, 50);
listBox.HighlightMode = PdfHighlightMode.Outline;
// Creates list items
PdfListFieldItemCollection itemCollection = listBox.Items;
//Add the items to the list box
itemCollection.Add(new PdfListFieldItem("English", "English"));
itemCollection.Add(new PdfListFieldItem("French", "French"));
itemCollection.Add(new PdfListFieldItem("German", "German"));
listBox.SelectedIndex = 0;
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
'Create list box
Dim listBox As PdfListBoxField = New PdfListBoxField(page, "list1")
'Add the field to listbox.
document.Form.Fields.Add(listBox)
'Set the properties.
listBox.Bounds = New RectangleF(100, 350, 100, 50)
listBox.HighlightMode = PdfHighlightMode.Outline
' Creates list items
Dim itemCollection As PdfListFieldItemCollection = listBox.Items
'Add the items to the list box
itemCollection.Add(New PdfListFieldItem("English", "English"))
itemCollection.Add(New PdfListFieldItem("French", "French"))
itemCollection.Add(New PdfListFieldItem("German", "German"))
listBox.SelectedIndex = 0
document.Save("Form.pdf")
document.Close(True)
See Also
SelectedIndex
Gets or sets the first selected item in the list.
Declaration
public int SelectedIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the selected item. |
Examples
//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create list box
PdfListBoxField listBox = new PdfListBoxField(page, "list1");
//Add the field to listbox.
document.Form.Fields.Add(listBox);
//Set the properties.
listBox.Bounds = new RectangleF(100, 350, 100, 50);
listBox.HighlightMode = PdfHighlightMode.Outline;
// Creates list items
PdfListFieldItemCollection itemCollection = listBox.Items;
//Add the items to the list box
itemCollection.Add(new PdfListFieldItem("English", "English"));
itemCollection.Add(new PdfListFieldItem("French", "French"));
itemCollection.Add(new PdfListFieldItem("German", "German"));
//Set the first selected item in the list.
listBox.SelectedIndex = 0;
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
'Create list box
Dim listBox As PdfListBoxField = New PdfListBoxField(page, "list1")
'Add the field to listbox.
document.Form.Fields.Add(listBox)
'Set the properties.
listBox.Bounds = New RectangleF(100, 350, 100, 50)
listBox.HighlightMode = PdfHighlightMode.Outline
' Creates list items
Dim itemCollection As PdfListFieldItemCollection = listBox.Items
'Add the items to the list box
itemCollection.Add(New PdfListFieldItem("English", "English"))
itemCollection.Add(New PdfListFieldItem("French", "French"))
itemCollection.Add(New PdfListFieldItem("German", "German"))
'Set the first selected item in the list.
listBox.SelectedIndex = 0
document.Save("Form.pdf")
document.Close(True)
See Also
SelectedItem
Gets the first selected item in the list.[Read-Only]
Declaration
public PdfListFieldItem SelectedItem { get; }
Property Value
Type | Description |
---|---|
PdfListFieldItem | The selected item. |
Examples
//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create list box
PdfListBoxField listBox = new PdfListBoxField(page, "list1");
//Add the field to listbox.
document.Form.Fields.Add(listBox);
//Set the properties.
listBox.Bounds = new RectangleF(100, 350, 100, 50);
listBox.HighlightMode = PdfHighlightMode.Outline;
// Creates list items
PdfListFieldItemCollection itemCollection = listBox.Items;
//Add the items to the list box
itemCollection.Add(new PdfListFieldItem("English", "English"));
itemCollection.Add(new PdfListFieldItem("French", "French"));
itemCollection.Add(new PdfListFieldItem("German", "German"));
//Get the first selected item in the list.
PdfListFieldItem selectedItem = listBox.SelectedItem;
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
'Create list box
Dim listBox As PdfListBoxField = New PdfListBoxField(page, "list1")
'Add the field to listbox.
document.Form.Fields.Add(listBox)
'Set the properties.
listBox.Bounds = New RectangleF(100, 350, 100, 50)
listBox.HighlightMode = PdfHighlightMode.Outline
' Creates list items
Dim itemCollection As PdfListFieldItemCollection = listBox.Items
'Add the items to the list box
itemCollection.Add(New PdfListFieldItem("English", "English"))
itemCollection.Add(New PdfListFieldItem("French", "French"))
itemCollection.Add(New PdfListFieldItem("German", "German"))
'Get the first selected item in the list.
Dim selectedItem As PdfListFieldItem = listBox.SelectedItem
document.Save("Form.pdf")
document.Close(True)
See Also
SelectedValue
Gets or sets the value of the first selected item in the list.
Declaration
public string SelectedValue { get; set; }
Property Value
Type | Description |
---|---|
System.String | The selected value. |
Examples
//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create list box
PdfListBoxField listBox = new PdfListBoxField(page, "list1");
//Add the field to listbox.
document.Form.Fields.Add(listBox);
//Set the properties.
listBox.Bounds = new RectangleF(100, 350, 100, 50);
listBox.HighlightMode = PdfHighlightMode.Outline;
// Creates list items
PdfListFieldItemCollection itemCollection = listBox.Items;
//Add the items to the list box
itemCollection.Add(new PdfListFieldItem("English", "English"));
itemCollection.Add(new PdfListFieldItem("French", "French"));
itemCollection.Add(new PdfListFieldItem("German", "German"));
//Set the value of the first selected item in the list.
listBox.SelectedValue = "English";
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
'Create list box
Dim listBox As PdfListBoxField = New PdfListBoxField(page, "list1")
'Add the field to listbox.
document.Form.Fields.Add(listBox)
'Set the properties.
listBox.Bounds = New RectangleF(100, 350, 100, 50)
listBox.HighlightMode = PdfHighlightMode.Outline
' Creates list items
Dim itemCollection As PdfListFieldItemCollection = listBox.Items
'Add the items to the list box
itemCollection.Add(New PdfListFieldItem("English", "English"))
itemCollection.Add(New PdfListFieldItem("French", "French"))
itemCollection.Add(New PdfListFieldItem("German", "German"))
'Set the value of the first selected item in the list.
listBox.SelectedValue = "English"
document.Save("Form.pdf")
document.Close(True)
See Also
Methods
Initialize()
Initializes an instance.
Declaration
protected override void Initialize()
Overrides
Implements
System.ComponentModel.INotifyPropertyChanged