ComponentOne for WinUI
選択モード
コントロール > ListView > ListViewの使い方 > 選択モード

The SelectionMode property determines how items are selected.

Mode

Description

None

Disables selection

Single

Allows selection of one item

Multiple

Allows selection of multiple items

Extended

Allows range selection

XAML
コードのコピー
<Grid>
  <TextBlock Text="SelectionMode" FontFamily="Segoe UI" FontSize="14" Margin="30 5 5 5"/>
  <ComboBox x:Name="cbSelectionMode" SelectedIndex="0" SelectionChanged="OnSelectionModeSelectionChanged" Width="100">
      <ComboBoxItem Content="Single"/>
      <ComboBoxItem Content="Extended"/>
      <ComboBoxItem Content="Multiple"/>
  </ComboBox>
  <c1:C1ListView x:Name="listView" DisplayMemberPath="Name" Grid.Row="2" Padding="10 0 0 0">
</Grid>
C#
コードのコピー
private void OnSelectionModeSelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e)
{
    if (listView != null)
    listView.SelectionMode = Enum.Parse<C1SelectionMode>((e.AddedItems[0] as ComboBoxItem).Content.ToString());
}