Xceed Toolkit Plus for WPF v5.0 Documentation
Xceed.Wpf.ListBox Assembly / Xceed.Wpf.ListBox Namespace / ListBox Class
Members Example


    ListBox Class
    Represents the core class of listbox control, which derives from Control and is used to display and manipulate data, containing a list of selectable items.
    Syntax
    'Declaration
     
    <TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")>
    <TemplatePartAttribute(Name="ScrollViewer", Type=System.Windows.Controls.ScrollViewer)>
    <ContentPropertyAttribute("Items")>
    <StyleTypedPropertyAttribute(Property="FocusVisualStyle", StyleTargetType=System.Windows.Controls.Control)>
    <XmlLangPropertyAttribute("Language")>
    <UsableDuringInitializationAttribute(True)>
    <RuntimeNamePropertyAttribute("Name")>
    <UidPropertyAttribute("Uid")>
    <TypeDescriptionProviderAttribute(MS.Internal.ComponentModel.DependencyObjectProvider)>
    <NameScopePropertyAttribute("NameScope", System.Windows.NameScope)>
    Public Class ListBox 
       Inherits System.Windows.Controls.Control
       Implements Xceed.Wpf.Controls.IDataNavigationHostXceed.Wpf.DragDrop.IDropTarget 
     
    'Usage
     
    Dim instance As ListBox
    Remarks

    The ListBox is a control that displays a collection of items. More than one item in a ListBox is visible at a time. Whether the ListBox allows multiple selections is set by using the SelectionMode property.

    Its content is set using the Items or ItemsSource properties.

    Example
    The following shows how to set up a listbox.
    <local:DemoView x:Class="Xceed.Wpf.Toolkit.LiveExplorer.Samples.ListBox.Views.ListBoxView" 
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer" 
                    xmlns:xclb="http://schemas.xceed.com/wpf/xaml/listbox"
                    xmlns:xclt="http://schemas.xceed.com/wpf/xaml/listbox/themes"
                    xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer.Samples.ListBox.Converters"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib" 
                    VerticalScrollBarVisibility="Disabled"
                    Title="ListBox">
       <local:DemoView.Resources>
           <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../ItemTemplates/ItemTemplates.xaml" />
             </ResourceDictionary.MergedDictionaries>
          </ResourceDictionary>
       </local:DemoView.Resources>
    
       <Grid>
          <xclb:ListBox ItemsSource="{Binding}" 
                        ItemTemplate="{StaticResource productListBoxItemTemplate}"
                        ToolPaneVisibility="Collapsed">
             <xclb:ListBox.Resources>
                <xclt:MetroLightThemeResourceDictionary AccentColor="Orange" />
             </xclb:ListBox.Resources>
          </xclb:ListBox>
       </Grid >
    
    </local:DemoView>
    Inheritance Hierarchy

    System.Object
       System.Windows.Threading.DispatcherObject
          System.Windows.DependencyObject
             System.Windows.Media.Visual
                System.Windows.UIElement
                   System.Windows.FrameworkElement
                      System.Windows.Controls.Control
                         Xceed.Wpf.ListBox.ListBox

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also