Table of Contents

Class PdfListField

Namespace
Syncfusion.Pdf.Interactive
Assembly
Syncfusion.Pdf.Portable.dll

Represents base class for form's list fields.

public abstract class PdfListField : PdfAppearanceField, INotifyPropertyChanged
Inheritance
PdfListField
Implements
Derived
Inherited Members

Constructors

PdfListField(PdfPageBase, string)

Initializes a new instance of the PdfListField class with the specific page and name.

public PdfListField(PdfPageBase page, string name)

Parameters

page PdfPageBase

Page which the field to be placed on.

name string

The name of the field.

See Also

Properties

Items

Gets the list field items.[Read-Only]

public PdfListFieldItemCollection Items { get; }

Property Value

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.

public int SelectedIndex { get; set; }

Property Value

int

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]

public PdfListFieldItem SelectedItem { get; }

Property Value

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.

public string SelectedValue { get; set; }

Property Value

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.

protected override void Initialize()
See Also

See Also