DataGrid: SelectionUnit FullRow

Jul 24, 2009 at 6:47 AM

Hi!

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?

Thanks!

Jus

 

Nov 23, 2009 at 12:13 AM

Hi,

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?

Thank-you

Joe

 

 

Nov 23, 2009 at 12:35 AM
Edited Nov 23, 2009 at 12:42 AM

Hi,

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:DataGrid.Columns> 
       <data:DataGridTextColumn x:Name="IDColumn" Header="ID" Binding="{Binding ID}" Width="*"/> 
    </data:DataGrid.Columns> 
 </data:DataGrid>