Philippe Lavoie
Philippe Lavoie

Reputation: 2593

WPF XAML : How to disable multi selection in a DataGrid?

In a DataGrid like this :

<DataGrid  AutoGenerateColumns="False" Height="200" Name="dataGrid"
    IsReadOnly="True" ItemsSource="{Binding CollectionView}" >
...
</Datagrid>

How do you disable the multi selection feature ?

(I'm sure it's simple, but I don't find it.)

Upvotes: 49

Views: 26616

Answers (2)

nate wew
nate wew

Reputation: 189

set the DataGrid.MultiSelect

this.DataGrid.MultiSelect = "false"

Upvotes: 1

Reed Copsey
Reed Copsey

Reputation: 564641

Set the DataGrid.SelectionMode:

<DataGrid SelectionMode="Single" ...

Upvotes: 112

Related Questions