Single Click Editing problem

Nov 6, 2008 at 5:33 PM
I tried out the approach of tips and tricks but it 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" />









Many zhanks in advanced.


Nov 7, 2008 at 3:34 PM
Hi WorstCase,

We updated the Single Click Editing How-To yesterday so that it will handle the FullRow case.  Let us know if you have any questions.

Nov 10, 2008 at 5:37 PM
Thank you Samantha.
I'm using also the SelectionChanged event.
When using the event handlers together, then the SelectionChanged event fires twice. First time for the row that losses the focus and second for the new row I want to select.

So I guess the best way is to use the RowClick event instead.
Is there a RowClick event  available?

Many thanks in advanced.