SelectionMode 枚举

定义

定义 ListBox 的选择行为。Defines the selection behavior for a ListBox.

public enum class SelectionMode
public enum SelectionMode
type SelectionMode = 
Public Enum SelectionMode
继承
SelectionMode

字段

Extended 2

用户可以按下 Shift 键来选择多个连续项。The user can select multiple consecutive items while holding down the SHIFT key.

Multiple 1

用户可以选择多个项而无需按下修改键。The user can select multiple items without holding down a modifier key.

Single 0

用户一次只能选择一项。The user can select only one item at a time.

示例

下面的示例将属性SelectionMode设置为 "多"。The following example sets the SelectionMode property to Multiple.

<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>

注解

将属性设置为SelectionMode值之一, 以指定用户是否可以在列表框中选择更多的项。 SelectionModeSet the SelectionMode property to one of the SelectionMode values to specify whether the user can select more that one item in a list box.

适用于