skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop
    Web
    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX UI for Silverlight UI for PHP UI for JSP
    Mobile
    UI for .NET MAUI UI for Xamarin
    Document Management
    Telerik Document Processing
    Desktop
    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF UI for UWP
    Reporting & Mocking
    Telerik Reporting Telerik Report Server Telerik JustMock
    Automated Testing
    Test Studio Test Studio Dev Edition
    CMS
    Sitefinity
    UI/UX Tools
    ThemeBuilder Design System Kit
    Debugging
    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Jam FiddlerCap FiddlerCore
    Extended Reality
    UI for Unity XR
    Free Tools
    JustAssembly JustDecompile VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Release History
  • Docs & Support
  • Pricing
  • Search
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class ListBox

Represents a ListBox control.

Inheritance
System.Object
ItemsControl
Selector
ListBox
Inherited Members
Selector.SelectedValuePathProperty
Selector.SelectedValueProperty
Selector.IsSelectedProperty
Selector.SelectedIndexProperty
Selector.SelectedItemProperty
Selector.SelectedEvent
Selector.SelectionChangedEvent
Selector.UnselectedEvent
Selector.add_SelectionChanged(SelectionChangedEventHandler)
Selector.remove_SelectionChanged(SelectionChangedEventHandler)
Selector.GetIsSelected(DependencyObject)
Selector.AddSelectedHandler(DependencyObject, RoutedEventHandler)
Selector.AddUnselectedHandler(DependencyObject, RoutedEventHandler)
Selector.RemoveSelectedHandler(DependencyObject, RoutedEventHandler)
Selector.RemoveUnselectedHandler(DependencyObject, RoutedEventHandler)
Selector.SetIsSelected(DependencyObject, Boolean)
Selector.OnItemsChanged(NotifyCollectionChangedEventArgs)
Selector.OnSelectedValueChanged(Object, Object)
Selector.OnSelectedValuePathChanged(String, String)
Selector.SelectedValuePath
Selector.SelectedValue
Selector.SelectedIndex
Selector.SelectedItem
Selector.SelectionChanged
ItemsControl.ItemContainerStyleProperty
ItemsControl.IsTextSearchEnabledProperty
ItemsControl.ItemContainerStyleSelectorProperty
ItemsControl.ItemTemplateSelectorProperty
ItemsControl.IsFocusedProperty
ItemsControl.HasItemsProperty
ItemsControl.ItemsControlFromItemContainer(DependencyObject)
ItemsControl.ChangeVisualState()
ItemsControl.ChangeVisualState(Boolean)
ItemsControl.OnIsEnabledChanged(DependencyPropertyChangedEventArgs)
ItemsControl.OnGotFocus(RoutedEventArgs)
ItemsControl.OnLostFocus(RoutedEventArgs)
ItemsControl.OnItemTemplateSelectorChanged(DataTemplateSelector, DataTemplateSelector)
ItemsControl.PrepareContainerForItemOverride(DependencyObject, Object)
ItemsControl.OnIsFocusedChanged(DependencyPropertyChangedEventArgs)
ItemsControl.IsTextSearchEnabled
ItemsControl.HasItems
ItemsControl.IsFocused
ItemsControl.ItemContainerStyle
ItemsControl.ItemContainerStyleSelector
ItemsControl.ItemTemplateSelector
ItemsControl.OverrideStyles
ItemsControl.ItemContainerGenerator
Namespace: Telerik.Windows.Controls
Assembly: Telerik.Windows.Controls.dll

Syntax

public class ListBox : Selector

Constructors

ListBox()

Initializes a new instance of the ListBox class.

Declaration
public ListBox()

Fields

SelectedItemsProperty

Identifies the SelectedItems dependency property.

Declaration
public static readonly DependencyProperty SelectedItemsProperty
Field Value
System.Windows.DependencyProperty

SelectionModeProperty

Identifies the SelectionMode dependency property.

Declaration
public static readonly DependencyProperty SelectionModeProperty
Field Value
System.Windows.DependencyProperty

Properties

AnchorItem

The current anchor item.

Declaration
protected object AnchorItem { get; set; }
Property Value
System.Object

FocusedIndex

Gets the index of the focused ListBox item.

Declaration
protected int FocusedIndex { get; }
Property Value
System.Int32

FocusedItem

Gets the focused item.

Declaration
public ListBoxItem FocusedItem { get; }
Property Value
ListBoxItem

The focused item.

SelectedItems

Gets or sets the selected items.

Declaration
public IList SelectedItems { get; }
Property Value
System.Collections.IList

The selected items.

SelectionMode

Gets or sets the selection mode.

Declaration
public SelectionMode SelectionMode { get; set; }
Property Value
SelectionMode

The selection mode.

Methods

ElementScrollViewerScrollInDirection(Key)

Scrolls the ScrollViewer element in the specified direction, if present in the control template.

Declaration
protected void ElementScrollViewerScrollInDirection(Key key)
Parameters
System.Windows.Input.Key key

GetContainerForItemOverride()

Creates or identifies the element used to display a specified item.

Declaration
protected override DependencyObject GetContainerForItemOverride()
Returns
System.Windows.DependencyObject

A System.Windows.Controls.ListBoxItem.

HandleKeyDown(Key, ListBoxItem)

Handles the keyboard input.

Declaration
protected virtual bool HandleKeyDown(Key key, ListBoxItem originalSource)
Parameters
System.Windows.Input.Key key

ListBoxItem originalSource

Returns
System.Boolean

IsItemItsOwnContainerOverride(Object)

Determines if the specified item is (or is eligible to be) its own container.

Declaration
protected override bool IsItemItsOwnContainerOverride(object item)
Parameters
System.Object item

The item to check.

Returns
System.Boolean

True if the item is (or is eligible to be) its own container; otherwise, false.

IsVerticalOrientation()

Gets the value specifying whether the control is vertical, or not.

Declaration
protected bool IsVerticalOrientation()
Returns
System.Boolean

MakeAnchorSelection(ListBoxItem)

Selects the items between the current anchor item and the specified item.

Declaration
protected void MakeAnchorSelection(ListBoxItem actionItem)
Parameters
ListBoxItem actionItem

The item that has been clicked.

MakeAnchorSelection(ListBoxItem, Boolean)

Selects the items between the current anchor item and the specified item.

Declaration
protected void MakeAnchorSelection(ListBoxItem actionItem, bool clearCurrent)
Parameters
ListBoxItem actionItem

The item that has been clicked.

System.Boolean clearCurrent

Boolean specifying whether to clear the current selection or not.

MakeSingleSelection(ListBoxItem)

Selects the specified item, unselects any other selected items.

Declaration
protected void MakeSingleSelection(ListBoxItem listItem)
Parameters
ListBoxItem listItem

The item to select.

MakeToggleSelection(ListBoxItem)

Toggles the selected state of the specified item. Updates the anchor item.

Declaration
protected void MakeToggleSelection(ListBoxItem item)
Parameters
ListBoxItem item

The item.

NavigateNext()

Navigates to the next item.

Declaration
protected void NavigateNext()

NavigatePrev()

Navigates to the previous item.

Declaration
protected void NavigatePrev()

NavigateToItem(Object)

Navigates to the specified item.

Declaration
protected void NavigateToItem(object item)
Parameters
System.Object item

The item.

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call System.Windows.Controls.Control.ApplyTemplate.

Declaration
public override void OnApplyTemplate()
Overrides
ItemsControl.OnApplyTemplate()

OnKeyDown(Object, KeyEventArgs)

Called when OnKeyDown event is raised.

Declaration
protected virtual void OnKeyDown(object sender, KeyEventArgs e)
Parameters
System.Object sender

The sender.

System.Windows.Input.KeyEventArgs e

The System.Windows.Input.KeyEventArgs instance containing the event data.

OnSelectionChanged(SelectionChangedEventArgs)

Called when the selection changes.

Declaration
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
Parameters
System.Windows.Controls.SelectionChangedEventArgs e

The event data.

Overrides
Selector.OnSelectionChanged(SelectionChangedEventArgs)

ScrollIntoView(Object)

Scrolls the control to the specified item.

Declaration
protected void ScrollIntoView(object item)
Parameters
System.Object item

Select(Object)

Selects the specified item.

Declaration
protected void Select(object item)
Parameters
System.Object item

The item.

SelectAll()

Selects all.

Declaration
public void SelectAll()
Exceptions
System.NotSupportedException

NotSupportedException.

SetFocusedItem(Int32, Boolean)

Focuses the item at the specified index, optionally scrolling the control to make it visible.

Declaration
protected void SetFocusedItem(int index, bool scrollIntoView)
Parameters
System.Int32 index

System.Boolean scrollIntoView

Extension Methods

CollectionExtensions.ToEnumerable<T>(T)
EnumerableExtensions.ToEnumerable<T>(T)

Was this article helpful?

Tell us how we can improve this article

Skip
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.