Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

SelectionMode Enumeration

Defines the selection behavior for a ListBox.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public enum SelectionMode
public enum SelectionMode
public enum SelectionMode
<object property="EnumerationValue" .../>
 Member nameDescription
ExtendedThe user can select multiple consecutive items while holding down the SHIFT key.  
MultipleThe user can select multiple items without holding down a modifier key. 
SingleThe user can select only one item at a time.  

Set the SelectionMode property to one of the SelectionMode values to specify whether the user can select more that one item in a list box.

This example shows how to set the selection modes for ListBox. The SelectionMode property indicates how many ListBoxItem elements a user can select at one time. You can set this property to Single (the default value), Multiple, or Extended. The following example shows how to create a ListBox where users can select more than one item (Multiple selections).

<ListBox SelectionMode="Multiple">
  <DockPanel>
    <Image Source="data\cat.png"/>
    <TextBlock>CAT</TextBlock>
  </DockPanel>
  <DockPanel>
    <Image Source="data\dog.png"/>
    <TextBlock>DOG</TextBlock>
  </DockPanel>
  <DockPanel>
    <Image Source="data\fish.png"/>
    <TextBlock>FISH</TextBlock>
  </DockPanel>
</ListBox>

For the complete sample, see List Box Sample.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.