I have TextBlocks in a XamDataGrid.
In edit mode, I'm trying to control each cell's IsEnabled property based on some condition so that users cannot edit the cell.
However, even though it's IsEnabled property is False, I can paste value into the cell in the grid.
I could have workaround using CellUpdating event. (setting eventArg.Cancel = True)
But, it's a lot of work fixing all the screens we have.
I think there should be a way for cell level editing handling.
Do you have any idea?
Hello,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.
Thank you for quick reply.
I guess I have to go with CellUpdatingEvent then.
There is no IsEnabled on the Cell object so I have to assume that you mean a CellValuePresenter or some element nested within that. The control cannot rely on the presence of the elements or its state since elements like recordpresenters and cellvaluepresenters are virtualized so if we did try to look at the state of the element then you would get inconsistent results depending on whether the cells that would be affected are in view or not (or more accurately whether elements have been allocated/associated with a given record/cell). If you need to prevent editing/pasting at a cell level then you need to handle an event like the CellUpdating.