Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
617 lines (573 sloc) 38.4 KB
<Type Name="ListBox" FullName="System.Windows.Controls.ListBox">
<TypeSignature Language="C#" Value="public class ListBox : System.Windows.Controls.Primitives.Selector" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi ListBox extends System.Windows.Controls.Primitives.Selector" />
<TypeSignature Language="DocId" Value="T:System.Windows.Controls.ListBox" />
<TypeSignature Language="VB.NET" Value="Public Class ListBox&#xA;Inherits Selector" />
<TypeSignature Language="C++ CLI" Value="public ref class ListBox : System::Windows::Controls::Primitives::Selector" />
<TypeSignature Language="F#" Value="type ListBox = class&#xA; inherit Selector" />
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Windows.Controls.Primitives.Selector</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName>System.Windows.Localizability(System.Windows.LocalizationCategory.ListBox)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Windows.StyleTypedProperty(Property="ItemContainerStyle", StyleTargetType=typeof(System.Windows.Controls.ListBoxItem))</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Contains a list of selectable items.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Windows.Controls.ListBox> is an <xref:System.Windows.Controls.ItemsControl>, which means it can contain a collection of objects of any type (such as string, image, or panel). For more information, see the <xref:System.Windows.Controls.ItemsControl> class.
More than one item in a <xref:System.Windows.Controls.ListBox> is visible, unlike the <xref:System.Windows.Controls.ComboBox>, which has only the selected item visible unless the <xref:System.Windows.Controls.ComboBox.IsDropDownOpen%2A> property is `true`. The <xref:System.Windows.Controls.ListBox.SelectionMode%2A> property determines whether more than one item in the <xref:System.Windows.Controls.ListBox> is selectable at a time.
The <xref:System.Windows.Controls.ListBox.SelectionMode%2A> property determines how many items a user can select at one time. You can set the property to <xref:System.Windows.Controls.SelectionMode.Single> (the default), <xref:System.Windows.Controls.SelectionMode.Multiple>, or <xref:System.Windows.Controls.SelectionMode.Extended>. The following table described the behavior of these enumeration values.
|Value|Description|
|-----------|-----------------|
|<xref:System.Windows.Controls.SelectionMode.Single>|The user can select only one item at a time.|
|<xref:System.Windows.Controls.SelectionMode.Multiple>|The user can select multiple items without holding down a modifier key.|
|<xref:System.Windows.Controls.SelectionMode.Extended>|The user can select multiple consecutive items while holding down the SHIFT key or non-consecutive items by holding down the CTRL key and clicking the items.|
<xref:System.Windows.Controls.ListBox> controls are often used with data binding. For more information, see [Data Binding Overview](~/docs/framework/wpf/data/data-binding-overview.md).
Displaying a large number of items may cause performance issues. See [Optimizing Performance: Controls](~/docs/framework/wpf/advanced/optimizing-performance-controls.md) for more information.
## Customizing the ListBox Control
To apply the same property settings to multiple <xref:System.Windows.Controls.ListBox> controls, use the <xref:System.Windows.FrameworkElement.Style%2A> property. You can modify the default <xref:System.Windows.Controls.ControlTemplate> to give the control a unique appearance. For more information about creating a <xref:System.Windows.Controls.ControlTemplate>, see [Customizing the Appearance of an Existing Control by Creating a ControlTemplate](~/docs/framework/wpf/controls/customizing-the-appearance-of-an-existing-control.md). To see the parts and states that are specific to the <xref:System.Windows.Controls.ListBox>, see [ListBox Styles and Templates](~/docs/framework/wpf/controls/listbox-styles-and-templates.md).
Dependency properties for this control might be set by the control's default style. If a property is set by a default style, the property might change from its default value when the control appears in the application. The default style is determined by which desktop theme is used when the application is running. For more information, see [Default WPF Themes](https://go.microsoft.com/fwlink/?LinkID=158252).
[!INCLUDE[setting-a-visual-property](~/includes/visual-property-note.md)]
## Examples
The following example creates a <xref:System.Windows.Controls.ListBox> and subscribes to the <xref:System.Windows.Controls.Primitives.Selector.SelectionChanged> event.
[!code-xaml[ListBoxEvent#1](~/samples/snippets/csharp/VS_Snippets_Wpf/ListBoxEvent/CSharp/Pane1.xaml#1)]
[!code-csharp[ListBoxEvent#2](~/samples/snippets/csharp/VS_Snippets_Wpf/ListBoxEvent/CSharp/Pane1.xaml.cs#2)]
[!code-vb[ListBoxEvent#2](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ListBoxEvent/VisualBasic/Pane1.xaml.vb#2)]
]]></format>
</remarks>
<related type="ExternalDocumentation" href="https://go.microsoft.com/fwlink/?LinkID=160053">WPF Controls Gallery Sample</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ListBox ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; ListBox();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Windows.Controls.ListBox" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="AnchorItem">
<MemberSignature Language="C#" Value="protected object AnchorItem { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance object AnchorItem" />
<MemberSignature Language="DocId" Value="P:System.Windows.Controls.ListBox.AnchorItem" />
<MemberSignature Language="VB.NET" Value="Protected Property AnchorItem As Object" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; property System::Object ^ AnchorItem { System::Object ^ get(); void set(System::Object ^ value); };" />
<MemberSignature Language="F#" Value="member this.AnchorItem : obj with get, set" Usage="System.Windows.Controls.ListBox.AnchorItem" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the item that is initially selected when <see cref="P:System.Windows.Controls.ListBox.SelectionMode" /> is <see cref="F:System.Windows.Controls.SelectionMode.Extended" />.</summary>
<value>The item that is initially selected when <see cref="P:System.Windows.Controls.ListBox.SelectionMode" /> is <see cref="F:System.Windows.Controls.SelectionMode.Extended" />.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="GetContainerForItemOverride">
<MemberSignature Language="C#" Value="protected override System.Windows.DependencyObject GetContainerForItemOverride ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance class System.Windows.DependencyObject GetContainerForItemOverride() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.GetContainerForItemOverride" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function GetContainerForItemOverride () As DependencyObject" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override System::Windows::DependencyObject ^ GetContainerForItemOverride();" />
<MemberSignature Language="F#" Value="override this.GetContainerForItemOverride : unit -&gt; System.Windows.DependencyObject" Usage="listBox.GetContainerForItemOverride " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.DependencyObject</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates or identifies the element used to display a specified item.</summary>
<returns>The element used to display a specified item.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="HandlesScrolling">
<MemberSignature Language="C#" Value="protected internal override bool HandlesScrolling { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool HandlesScrolling" />
<MemberSignature Language="DocId" Value="P:System.Windows.Controls.ListBox.HandlesScrolling" />
<MemberSignature Language="VB.NET" Value="Protected Friend Overrides ReadOnly Property HandlesScrolling As Boolean" />
<MemberSignature Language="C++ CLI" Value="protected public:&#xA; virtual property bool HandlesScrolling { bool get(); };" />
<MemberSignature Language="F#" Value="member this.HandlesScrolling : bool" Usage="System.Windows.Controls.ListBox.HandlesScrolling" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value that indicates whether the <see cref="T:System.Windows.Controls.ListBox" /> supports scrolling.</summary>
<value>
<see langword="true" /> if the <see cref="T:System.Windows.Controls.ListBox" /> supports scrolling; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the control has a <xref:System.Windows.Controls.ScrollViewer> in its style and has a custom keyboard scrolling behavior, <xref:System.Windows.Controls.ListBox.HandlesScrolling%2A> should return `true`.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="IsItemItsOwnContainerOverride">
<MemberSignature Language="C#" Value="protected override bool IsItemItsOwnContainerOverride (object item);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance bool IsItemItsOwnContainerOverride(object item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.IsItemItsOwnContainerOverride(System.Object)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function IsItemItsOwnContainerOverride (item As Object) As Boolean" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override bool IsItemItsOwnContainerOverride(System::Object ^ item);" />
<MemberSignature Language="F#" Value="override this.IsItemItsOwnContainerOverride : obj -&gt; bool" Usage="listBox.IsItemItsOwnContainerOverride item" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="item" Type="System.Object" />
</Parameters>
<Docs>
<param name="item">Specified item.</param>
<summary>Determines if the specified item is (or is eligible to be) its own <c>ItemContainer</c>.</summary>
<returns>
<see langword="true" /> if the item is its own <see langword="ItemContainer" />; otherwise, <see langword="false" />.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="OnCreateAutomationPeer">
<MemberSignature Language="C#" Value="protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutomationPeer ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance class System.Windows.Automation.Peers.AutomationPeer OnCreateAutomationPeer() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.OnCreateAutomationPeer" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function OnCreateAutomationPeer () As AutomationPeer" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override System::Windows::Automation::Peers::AutomationPeer ^ OnCreateAutomationPeer();" />
<MemberSignature Language="F#" Value="override this.OnCreateAutomationPeer : unit -&gt; System.Windows.Automation.Peers.AutomationPeer" Usage="listBox.OnCreateAutomationPeer " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Automation.Peers.AutomationPeer</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Provides an appropriate <see cref="T:System.Windows.Automation.Peers.ListBoxAutomationPeer" /> implementation for this control, as part of the [!INCLUDE[TLA2#tla_winclient](~/includes/tla2sharptla-winclient-md.md)] automation infrastructure.</summary>
<returns>The type-specific <see cref="T:System.Windows.Automation.Peers.AutomationPeer" /> implementation.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="OnIsMouseCapturedChanged">
<MemberSignature Language="C#" Value="protected override void OnIsMouseCapturedChanged (System.Windows.DependencyPropertyChangedEventArgs e);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void OnIsMouseCapturedChanged(valuetype System.Windows.DependencyPropertyChangedEventArgs e) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.OnIsMouseCapturedChanged(System.Windows.DependencyPropertyChangedEventArgs)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub OnIsMouseCapturedChanged (e As DependencyPropertyChangedEventArgs)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void OnIsMouseCapturedChanged(System::Windows::DependencyPropertyChangedEventArgs e);" />
<MemberSignature Language="F#" Value="override this.OnIsMouseCapturedChanged : System.Windows.DependencyPropertyChangedEventArgs -&gt; unit" Usage="listBox.OnIsMouseCapturedChanged e" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="e" Type="System.Windows.DependencyPropertyChangedEventArgs" />
</Parameters>
<Docs>
<param name="e">Provides data for the <see cref="T:System.Windows.DependencyPropertyChangedEventArgs" />.</param>
<summary>Called when the <see cref="P:System.Windows.UIElement.IsMouseCaptured" /> property changes.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="OnKeyDown">
<MemberSignature Language="C#" Value="protected override void OnKeyDown (System.Windows.Input.KeyEventArgs e);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void OnKeyDown(class System.Windows.Input.KeyEventArgs e) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.OnKeyDown(System.Windows.Input.KeyEventArgs)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub OnKeyDown (e As KeyEventArgs)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void OnKeyDown(System::Windows::Input::KeyEventArgs ^ e);" />
<MemberSignature Language="F#" Value="override this.OnKeyDown : System.Windows.Input.KeyEventArgs -&gt; unit" Usage="listBox.OnKeyDown e" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="e" Type="System.Windows.Input.KeyEventArgs" />
</Parameters>
<Docs>
<param name="e">Provides data for <see cref="T:System.Windows.Input.KeyEventArgs" />.</param>
<summary>Responds to the <see cref="E:System.Windows.UIElement.KeyDown" /> event.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="OnMouseMove">
<MemberSignature Language="C#" Value="protected override void OnMouseMove (System.Windows.Input.MouseEventArgs e);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void OnMouseMove(class System.Windows.Input.MouseEventArgs e) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.OnMouseMove(System.Windows.Input.MouseEventArgs)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub OnMouseMove (e As MouseEventArgs)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void OnMouseMove(System::Windows::Input::MouseEventArgs ^ e);" />
<MemberSignature Language="F#" Value="override this.OnMouseMove : System.Windows.Input.MouseEventArgs -&gt; unit" Usage="listBox.OnMouseMove e" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="e" Type="System.Windows.Input.MouseEventArgs" />
</Parameters>
<Docs>
<param name="e">Provides data for <see cref="T:System.Windows.Input.MouseEventArgs" />.</param>
<summary>Called when a <see cref="T:System.Windows.Controls.ListBox" /> reports a mouse move.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="OnSelectionChanged">
<MemberSignature Language="C#" Value="protected override void OnSelectionChanged (System.Windows.Controls.SelectionChangedEventArgs e);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void OnSelectionChanged(class System.Windows.Controls.SelectionChangedEventArgs e) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.OnSelectionChanged(System.Windows.Controls.SelectionChangedEventArgs)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub OnSelectionChanged (e As SelectionChangedEventArgs)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void OnSelectionChanged(System::Windows::Controls::SelectionChangedEventArgs ^ e);" />
<MemberSignature Language="F#" Value="override this.OnSelectionChanged : System.Windows.Controls.SelectionChangedEventArgs -&gt; unit" Usage="listBox.OnSelectionChanged e" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="e" Type="System.Windows.Controls.SelectionChangedEventArgs" />
</Parameters>
<Docs>
<param name="e">Provides data for <see cref="T:System.Windows.Controls.SelectionChangedEventArgs" />.</param>
<summary>Responds to a list box selection change by raising a <see cref="E:System.Windows.Controls.Primitives.Selector.SelectionChanged" /> event.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="PrepareContainerForItemOverride">
<MemberSignature Language="C#" Value="protected override void PrepareContainerForItemOverride (System.Windows.DependencyObject element, object item);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void PrepareContainerForItemOverride(class System.Windows.DependencyObject element, object item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.PrepareContainerForItemOverride(System.Windows.DependencyObject,System.Object)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub PrepareContainerForItemOverride (element As DependencyObject, item As Object)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void PrepareContainerForItemOverride(System::Windows::DependencyObject ^ element, System::Object ^ item);" />
<MemberSignature Language="F#" Value="override this.PrepareContainerForItemOverride : System.Windows.DependencyObject * obj -&gt; unit" Usage="listBox.PrepareContainerForItemOverride (element, item)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="element" Type="System.Windows.DependencyObject" />
<Parameter Name="item" Type="System.Object" />
</Parameters>
<Docs>
<param name="element">Element used to display the specified item.</param>
<param name="item">Specified item.</param>
<summary>Prepares the specified element to display the specified item.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Preparing the element may involve applying styles, setting bindings, and so on.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="ScrollIntoView">
<MemberSignature Language="C#" Value="public void ScrollIntoView (object item);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void ScrollIntoView(object item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.ScrollIntoView(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Sub ScrollIntoView (item As Object)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void ScrollIntoView(System::Object ^ item);" />
<MemberSignature Language="F#" Value="member this.ScrollIntoView : obj -&gt; unit" Usage="listBox.ScrollIntoView item" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="item" Type="System.Object" />
</Parameters>
<Docs>
<param name="item">Object to scroll.</param>
<summary>Causes the object to scroll into view.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the object is not visible, it is aligned at the top or bottom of the viewport.
## Examples
The following example shows how to use the <xref:System.Windows.Controls.ListBox.ScrollIntoView%2A> method to scroll an item in the list box into the viewport.
[!code-csharp[ListBox_snip#ListBoxScrollIntoView](~/samples/snippets/csharp/VS_Snippets_Wpf/ListBox_snip/CSharp/Window1.xaml.cs#listboxscrollintoview)]
[!code-vb[ListBox_snip#ListBoxScrollIntoView](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ListBox_snip/visualbasic/window1.xaml.vb#listboxscrollintoview)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="SelectAll">
<MemberSignature Language="C#" Value="public void SelectAll ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void SelectAll() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.SelectAll" />
<MemberSignature Language="VB.NET" Value="Public Sub SelectAll ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void SelectAll();" />
<MemberSignature Language="F#" Value="member this.SelectAll : unit -&gt; unit" Usage="listBox.SelectAll " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Selects all the items in a <see cref="T:System.Windows.Controls.ListBox" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example shows how to use the <xref:System.Windows.Controls.ListBox.SelectAll%2A> method to select and highlight all the items in a list box.
[!code-csharp[ListBox_snip#ListBoxSelectAll](~/samples/snippets/csharp/VS_Snippets_Wpf/ListBox_snip/CSharp/Window1.xaml.cs#listboxselectall)]
[!code-vb[ListBox_snip#ListBoxSelectAll](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ListBox_snip/visualbasic/window1.xaml.vb#listboxselectall)]
]]></format>
</remarks>
<exception cref="T:System.NotSupportedException">The <see cref="P:System.Windows.Controls.ListBox.SelectionMode" /> property is set to <see cref="F:System.Windows.Controls.SelectionMode.Single" />.</exception>
</Docs>
</Member>
<Member MemberName="SelectedItems">
<MemberSignature Language="C#" Value="public System.Collections.IList SelectedItems { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.IList SelectedItems" />
<MemberSignature Language="DocId" Value="P:System.Windows.Controls.ListBox.SelectedItems" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property SelectedItems As IList" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Collections::IList ^ SelectedItems { System::Collections::IList ^ get(); };" />
<MemberSignature Language="F#" Value="member this.SelectedItems : System.Collections.IList" Usage="System.Windows.Controls.ListBox.SelectedItems" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Bindable(true)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Category("Appearance")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Collections.IList</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the currently selected items.</summary>
<value>Returns a collection of the currently selected items.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property is meant to be used when <xref:System.Windows.Controls.ListBox.SelectionMode%2A> does not equal <xref:System.Windows.Controls.SelectionMode.Single>. If the selection mode is <xref:System.Windows.Controls.SelectionMode.Single> the correct property to use is <xref:System.Windows.Controls.Primitives.Selector.SelectedItem%2A>.
<a name="dependencyPropertyInfo_SelectedItems"></a>
## Dependency Property Information
|||
|-|-|
|Identifier field|<xref:System.Windows.Controls.ListBox.SelectedItemsProperty>|
|Metadata properties set to `true`|None|
## Examples
The following example shows how to use the <xref:System.Windows.Controls.ListBox.SelectedItems%2A> property to determine whether a list box has any selected items.
[!code-csharp[ListBox_snip#ListBoxSelectedItems](~/samples/snippets/csharp/VS_Snippets_Wpf/ListBox_snip/CSharp/Window1.xaml.cs#listboxselecteditems)]
[!code-vb[ListBox_snip#ListBoxSelectedItems](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ListBox_snip/visualbasic/window1.xaml.vb#listboxselecteditems)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The <see cref="P:System.Windows.Controls.ListBox.SelectionMode" /> property is set to <see cref="F:System.Windows.Controls.SelectionMode.Single" />.</exception>
</Docs>
</Member>
<Member MemberName="SelectedItemsProperty">
<MemberSignature Language="C#" Value="public static readonly System.Windows.DependencyProperty SelectedItemsProperty;" />
<MemberSignature Language="ILAsm" Value=".field public static initonly class System.Windows.DependencyProperty SelectedItemsProperty" />
<MemberSignature Language="DocId" Value="F:System.Windows.Controls.ListBox.SelectedItemsProperty" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly SelectedItemsProperty As DependencyProperty " />
<MemberSignature Language="C++ CLI" Value="public: static initonly System::Windows::DependencyProperty ^ SelectedItemsProperty;" />
<MemberSignature Language="F#" Value=" staticval mutable SelectedItemsProperty : System.Windows.DependencyProperty" Usage="System.Windows.Controls.ListBox.SelectedItemsProperty" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.DependencyProperty</ReturnType>
</ReturnValue>
<Docs>
<summary>Identifies the <see cref="P:System.Windows.Controls.ListBox.SelectedItems" /> dependency property.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="SelectionMode">
<MemberSignature Language="C#" Value="public System.Windows.Controls.SelectionMode SelectionMode { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Windows.Controls.SelectionMode SelectionMode" />
<MemberSignature Language="DocId" Value="P:System.Windows.Controls.ListBox.SelectionMode" />
<MemberSignature Language="VB.NET" Value="Public Property SelectionMode As SelectionMode" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Windows::Controls::SelectionMode SelectionMode { System::Windows::Controls::SelectionMode get(); void set(System::Windows::Controls::SelectionMode value); };" />
<MemberSignature Language="F#" Value="member this.SelectionMode : System.Windows.Controls.SelectionMode with get, set" Usage="System.Windows.Controls.ListBox.SelectionMode" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Controls.SelectionMode</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the selection behavior for a <see cref="T:System.Windows.Controls.ListBox" />.</summary>
<value>One of the <see cref="T:System.Windows.Controls.SelectionMode" /> values. The default is <see cref="F:System.Windows.Controls.SelectionMode.Single" /> selection.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<a name="dependencyPropertyInfo_SelectionMode"></a>
## Dependency Property Information
|||
|-|-|
|Identifier field|<xref:System.Windows.Controls.ListBox.SelectionModeProperty>|
|Metadata properties set to `true`|None|
## Examples
The following example sets the <xref:System.Windows.Controls.ListBox.SelectionMode%2A> property to <xref:System.Windows.Controls.SelectionMode.Multiple>.
[!code-xaml[ListBoxEvent#4](~/samples/snippets/csharp/VS_Snippets_Wpf/ListBoxEvent/CSharp/Pane1.xaml#4)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="SelectionModeProperty">
<MemberSignature Language="C#" Value="public static readonly System.Windows.DependencyProperty SelectionModeProperty;" />
<MemberSignature Language="ILAsm" Value=".field public static initonly class System.Windows.DependencyProperty SelectionModeProperty" />
<MemberSignature Language="DocId" Value="F:System.Windows.Controls.ListBox.SelectionModeProperty" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly SelectionModeProperty As DependencyProperty " />
<MemberSignature Language="C++ CLI" Value="public: static initonly System::Windows::DependencyProperty ^ SelectionModeProperty;" />
<MemberSignature Language="F#" Value=" staticval mutable SelectionModeProperty : System.Windows.DependencyProperty" Usage="System.Windows.Controls.ListBox.SelectionModeProperty" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.DependencyProperty</ReturnType>
</ReturnValue>
<Docs>
<summary>Identifies the <see cref="P:System.Windows.Controls.ListBox.SelectionMode" /> dependency property.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="SetSelectedItems">
<MemberSignature Language="C#" Value="protected bool SetSelectedItems (System.Collections.IEnumerable selectedItems);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig instance bool SetSelectedItems(class System.Collections.IEnumerable selectedItems) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.SetSelectedItems(System.Collections.IEnumerable)" />
<MemberSignature Language="VB.NET" Value="Protected Function SetSelectedItems (selectedItems As IEnumerable) As Boolean" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; bool SetSelectedItems(System::Collections::IEnumerable ^ selectedItems);" />
<MemberSignature Language="F#" Value="member this.SetSelectedItems : System.Collections.IEnumerable -&gt; bool" Usage="listBox.SetSelectedItems selectedItems" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="selectedItems" Type="System.Collections.IEnumerable" />
</Parameters>
<Docs>
<param name="selectedItems">Collection of items to be selected.</param>
<summary>Sets a collection of selected items.</summary>
<returns>
<see langword="true" /> if all items have been selected; otherwise, <see langword="false" />.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="UnselectAll">
<MemberSignature Language="C#" Value="public void UnselectAll ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void UnselectAll() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Controls.ListBox.UnselectAll" />
<MemberSignature Language="VB.NET" Value="Public Sub UnselectAll ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void UnselectAll();" />
<MemberSignature Language="F#" Value="member this.UnselectAll : unit -&gt; unit" Usage="listBox.UnselectAll " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Clears all the selection in a <see cref="T:System.Windows.Controls.ListBox" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example shows how to use the <xref:System.Windows.Controls.ListBox.UnselectAll%2A> method to unselect all the items in a list box.
[!code-csharp[ListBox_snip#ListBoxUnselectAll](~/samples/snippets/csharp/VS_Snippets_Wpf/ListBox_snip/CSharp/Window1.xaml.cs#listboxunselectall)]
[!code-vb[ListBox_snip#ListBoxUnselectAll](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ListBox_snip/visualbasic/window1.xaml.vb#listboxunselectall)]
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.