Class ListBox
Contains a list of selectable items.
Inheritance
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.dll
Syntax
[TemplatePart(Name = "ScrollViewer", Type = typeof(ScrollViewer))]
public class ListBox : Selector
Constructors
| Improve this Doc View SourceListBox()
Initializes a new instance of the ListBox class.
Declaration
public ListBox()
Fields
| Improve this Doc View SourceItemContainerStyleProperty
Identifies the ItemContainerStyle dependency property.
Declaration
public static readonly DependencyProperty ItemContainerStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectionModeProperty
Identifies the SelectionMode dependency property.
Declaration
public static readonly DependencyProperty SelectionModeProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceItemContainerStyle
Gets or sets the style that is used when rendering the item containers.
Declaration
public Style ItemContainerStyle { get; set; }
Property Value
Type | Description |
---|---|
Style | The style applied to the item containers. The default is null. |
SelectedItems
Gets the list of currently selected items for the ListBox control.
Declaration
public IList SelectedItems { get; }
Property Value
Type | Description |
---|---|
System.Collections.IList | The list of currently selected items for the ListBox. |
SelectionMode
Gets or sets the selection behavior for the ListBox control.
Declaration
public SelectionMode SelectionMode { get; set; }
Property Value
Type | Description |
---|---|
SelectionMode | One of the SelectionMode values. |
Methods
| Improve this Doc View SourceGetContainerForItemOverride()
Creates or identifies the element used to display a specified item.
Declaration
protected override DependencyObject GetContainerForItemOverride()
Returns
Type | Description |
---|---|
DependencyObject | A ListBoxItem corresponding to a specified item. |
Overrides
| Improve this Doc View SourceIsItemItsOwnContainerOverride(Object)
Determines if the specified item is (or is eligible to be) its own item container.
Declaration
protected override bool IsItemItsOwnContainerOverride(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | The specified item. |
Returns
Type | Description |
---|---|
System.Boolean | true if the item is its own item container; otherwise, false. |
Overrides
| Improve this Doc View SourceScrollIntoView(Object)
Causes the object to scroll into view.
Declaration
public void ScrollIntoView(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | The object to scroll. |
SelectAll()
Selects all the items in the ListBox.
Declaration
public void SelectAll()
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | SelectionMode is set to Single |