Hi,
We are implementing Dirty flag detection into XamSpreashead control but we face problems to detect early change/delete/add actions. We attached to WorksheetDirtied event but this event is raised even when scroll is changed thus does not fit to our needs.
Additionally, checking received argument event SpreadsheetWorkbookDirtiedEventArgs does not bring any value either since has no additional information about cell (old and new value, added or deleted or changed, nor address of cell itself).
Currently we need to serialize and deserialize all workbook to achieve this and this very expensive operation since we might have very big worksheets (50+ Mb).
How to detect when cell is starting to change?
What value has changed to and what was before?
What was the action of the cell: delete or add?
What was the address of the Cell and in which worksheet?
Thanks in advance,
Tomas
Hello,
I have been looking into your question and after an investigation, I determined that there is no such event provided out of the box. I have implemented some custom logic to achieve similar behavior and get information like new value, old value, current worksheet, address, etc. of the edited cell.
I defined a struct called ChangedCell which stores information about the cell as per your requirements. In order to retrieve the currently active cell, on which editing or deletion may be executed I handle the ActiveCellChanged event of the XamSpreadsheet. From there the initial cell info, such as a worksheet, row, column, address and current value, could be get. If the cell was edited, its new value can be retrieved from the EditModeExiting event of the XamSpreadsheet. In order to detect if the cell was deleted, the KeyUp event of the XamSpreadsheet can be handled. If there is an active cell selected and the pressed key is "Delete", we know the cell was deleted.
I have attached a sample application, that uses the approach below.
Please keep in mind that the suggested approach is a workaround and in case it is not an accurate demonstration of what you are trying to achieve, my suggestion is submitting a new product idea. You can suggest new product ideas for future versions (or vote for existing ones) at <http://ideas.infragistics.com >.
There are many benefits to submitting a product idea:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
If you require any further assistance on the matter, please let me know.
Sincerely,Bozhidara PachilovaAssociate Software Developer
4747.XSDetectChangedCells.zip
Problems still occurring with used approach:
These answers are of course based on our limited knowledge with the events. If we missed a crucial point you are very welcome to point it out to us, we would be happy if there is already an existing and simple solution for our problem in the product.
I attached a minimal prototype with which you can verify our problems 1106.SpreadsheetMinimalPrototype.zip. If you start scrolling the WorkbookDirtied-Save button gets enabled (though it should not) and if you paste a value the EditModeExiting-Save button does not get enabled (though it should).
Same answer posted to Infragistics idea: https://ko.infragistics.com/community/ideas/i/ultimate-ui-for-wpf/xamlspreadsheet-events-on-user-cell-value-cell-value-range-changed
best regards,
Thanks for response. It works in most cases but it does not cover all possible combinations. So will have to create an idea then.