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

标签 wpf xaml datagrid multi-select

在这样的 DataGrid 中:

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

如何禁用多选功能?

(我确信这很简单,但我没有找到。)

最佳答案

设置DataGrid.SelectionMode :

<DataGrid SelectionMode="Single" ...

关于WPF XAML : How to disable multi selection in a DataGrid?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4890713/

相关文章:

c# - 如何从 XAML 访问代码中的对象

c# - 在WPF-MVVM中的“当前窗口”中保存并关闭

c# - WPF 应用程序 mp3 声音文件的相对路径

c# - WPF 验证 (IDataErrorInfo) 和制表符聚焦问题

c# - 为什么 OnPropertyChanged 在代码隐藏中不起作用?

WPF Datagrid selecteditem = MVVM 中的 null

c# - XAML 数据类型中的神秘 `1

c# - 外发光圆角 TextBox

c# - 如何将一个 View 模型绑定(bind)到数据网格,将另一个 View 模型绑定(bind)到其列的属性之一

c# - 如何用空行填充数据网格