DataGrid: SelectionUnit FullRow

Jul 24, 2009 at 5:47 AM


I have set the SelectionUnit to FullRow. This works fine, however I want the selection to extend over the whole row, including white spaces, when the columns do not fill up the whole control width.

See the behaviour of the WinForms ListView Control.

Is there a way to accomplish this?




Nov 22, 2009 at 11:13 PM


I have the same issue. It's inconsistent with the Silverlight Toolkit. The Silverlight Toolkit's DataGrid will do a Full row select consistent with a WinForms ListView control, but the WPF Toolkit's DataGrid will not, even with SelectionUnit="FullRow".

As "jus71" has asked - Is there a way to accomplish this with the WPF DataGrid Toolkit?





Nov 22, 2009 at 11:35 PM
Edited Nov 22, 2009 at 11:42 PM


A "workaround" for this is to simply make at least one of the DataGrid's column Width="*". This will at least ensure the columns/cells (read: selectable parts of the row) spread the width of the DataGrid.

An example of a Column declared within XAML:

<data:DataGrid x:Name="GroupData" ItemsSource="{Binding Groups}" AutoGenerateColumns="False" IsReadOnly="True" SelectedItem="{Binding SelectedGroup, Mode=TwoWay}"> 
       <data:DataGridTextColumn x:Name="IDColumn" Header="ID" Binding="{Binding ID}" Width="*"/>