Greg,
Here is the code that does the trick for me.
private void MyDataGrid_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs e)
{
DataGrid senderGrid = sender as DataGrid;
DataGrid.HitTestInfo hti = senderGrid.HitTest(e.X, e.Y);
if (hti.Type == DataGrid.HitTestType.Cell && "check here that the
right cell has been clicked")
{
bool itemChecked = !(bool) senderGrid[hti.Row, hti.Column];
senderGrid[hti.Row, hti.Column] = itemChecked;
senderGrid.EndEdit(MyDataGrid.TableStyles[0].GridColumnStyles[hti.Column],
hti.Row, false);
senderGrid.Refresh();
}
}
Girish
On Thu, Sep 9, 2010 at 11:54 PM, Greg Keogh <[email protected]> wrote:
> Ian et al, I have officially given up on this issue. I’m defeated and I
> told the customer that it would waste money if I kept researching it.
>
>
>
> I could replace the CheckBox column with my own bound column type that
> draws itself to make some kind of mock CheckBox, but that would take hours
> of work. I told the customer to tell his staff that the workaround is to
> press the Enter key on the offending cell on the top row. It’s stupid but
> it’s easy and it works.
>
>
>
> This reminds me of the other intermitted “bug” in grids that I create where
> pressing the Esc key on validation failed cell value doesn’t restore the
> previous value. I’ve spent hours of my life over the years trying to track
> this one down without success. Luckily it happens rarely now, and I detect
> it early and delete the whole control and make a fresh one and it usually
> comes good. Go figure!
>
>
>
> I’ll be migrating to WPF grids more in the future, so I’ll probably run
> into a whole new suite of weirdness and roadblocks.
>
>
>
> If I ever find the answer to this I’ll let you know.
>
>
>
> Greg
>