Single-Click Editing causes exception

Nov 6, 2008 at 1:46 PM
Hi Samanta,
Thank you for your reply yesterday regarding single click editing. Now I tried out your approach but ot does not work correctly.
The exception is:
{System.InvalidOperationException: Cannot change cell selection when the SelectionUnit is FullRow.
I'd like to use FullRow Selection. Is there another approach.

The other problem is, that I'm getting another color for the selected row or selected cell respectively when I have this.

Code behind:

dgc =

new DataGridCheckBoxColumn ();


dgc.Header =





Style checkBoxCellStyle = (Style)this.FindResource ("SingleClickEditing");


dgc.CellStyle = checkBoxCellStyle;

dgbc = (



b =

new Binding ("check_storage");


b.Mode =



dgbc.Binding = b;

dg.Columns.Add (dgc);





<Style x:Key="SingleClickEditing" TargetType="{x:Type dg:DataGridCell}" >





<EventSetter Event="PreviewMouseLeftButtonDown" Handler="DataGridCell_PreviewMouseLeftButtonDown"></EventSetter>





<Setter Property="MinHeight" Value="20" />





<Setter Property="HorizontalAlignment" Value="Stretch" />










<Trigger Property="IsSelected" Value="true">





<Setter Property="Background" Value="LightSeaGreen"/>




















<Condition Property="IsMouseOver" Value="true" />





<Condition Property="IsSelected" Value="false" />










<Setter Property="Background" Value="LightBlue" />



















Please help.
Many zhanks in advanced.



Nov 6, 2008 at 6:15 PM
Edited Nov 6, 2008 at 8:30 PM
I modified the Single Click editing code to account FullRow selection unit. Have a look at the latest at