svick svick - 1 year ago 220
C# Question

Disable selecting in WPF DataGrid

How can I disable selecting in a WPFTooklit's

I tried modifying the solution that works for
(from, but that doesn't work:

<Style TargetType="{x:Type tk:DataGridRow}">
<Setter Property="Focusable" Value="false"/>
<Style TargetType="{x:Type tk:DataGridCell}">
<Setter Property="Focusable" Value="false"/>

Answer Source

There is a trick for this. You can handle SelectionChanged event of the DataGrid(say dgGrid) and in the handler write:


It will unselect all selected row and result will be "No row selected".