I have a gridview where I edit a number of cells.
Issue 1
If in the validating code I set the cells back color it is not stable, when scrolling the highlighted cell can change, if I scroll an entire page the highlighted cell will repeat on subsequent cells.
I fixed this by using the cellstyleselector and basing the change on data in the underlying object. It is still a fault of the gridview.
Issue 2 - unsolved
If I scroll rapidly when in edit mode (the user holds down the arrow key) the values in the cells are set to 0. I believe this may be the fault of the validating code and the speed of the scroll. If the user presses esc twice after editing the cell the grid is no longer in edit mode and the data is secure. Is there a way to place the grid out of edit mode from the cellendedit event
Issue 1
If in the validating code I set the cells back color it is not stable, when scrolling the highlighted cell can change, if I scroll an entire page the highlighted cell will repeat on subsequent cells.
e.Cell.Foreground = new SolidColorBrush(Colors.Red);
Issue 2 - unsolved
If I scroll rapidly when in edit mode (the user holds down the arrow key) the values in the cells are set to 0. I believe this may be the fault of the validating code and the speed of the scroll. If the user presses esc twice after editing the cell the grid is no longer in edit mode and the data is secure. Is there a way to place the grid out of edit mode from the cellendedit event
private
void
lPCellEditEnd(GridViewCellEditEndedEventArgs e)
{
decimal
OriginalValue;
decimal
CurrentValue;
decimal
.TryParse(e.OldData.ToString(),
out
OriginalValue);
decimal
.TryParse(e.NewData.ToString(),
out
CurrentValue);
LPItemEditDB oLPEdit = e.Cell.DataContext
as
LPItemEditDB;
if
(CurrentValue != OriginalValue)
{
CurrentValue = DecimalTruncated(CurrentValue);
LPItemDB oLPItem = GetEditableLP(e.Cell.Column.UniqueName, oLPEdit, CurrentValue, OriginalValue);
//e.Cell.Foreground = new SolidColorBrush(Colors.Red);
CalcTotal(oLPEdit);
}
}