The XamDataGrid does not support Color data types by default, so I had to implement my own ColorEditor derived from the ValueEditor class.
The ColorEditor handles System.Windows.Media.Color data types and renders them as a filled rectangle showing the color.
Unfortunately when this editor is exported to Excel via the DataPresenterExcelExporter the Color gets converted to string, which is worthless from the user's perspective.
How can I enhance my editor so that the exported Excel cell will have the background color set? Is there an interface I can implement on my ColorEditor? Is there a routed event I can register a class handler to? Is there anything i can do at the editor level?
I know I could derive my own DataPresenterExcelExporter that has unique knowledge of the ColorEditor but that is a very poor solution
Hello,
The ExcelExporter exports only the data from the XamDataGrid, so if you want to export the customizations, you need to follow the approach I suggested in my previous post.
Stefan,
Thanks for looking into this. No this does not meet my needs. The goal is to generically enable custom export logic for my editor. Using this approach, consumers of the custom editor would need to always handle the cell exported event.
My question is:
Is there a way to customize my editor so that consumers of the editor do not need to write any special code when it comes to exporting? Is there any interface I can have my editor implement to customize this behavior?
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.
Thank you for your post. I have been looking into it and I created a sample project for you showing how you can achieve your goal. Basically I handled the DataPresenterExcelExporter’s CellExporting event and in it you can apply Setting to the Cell in the Excel Sheet. I put comments what you can do to achieve your goal. Please let me now if this helps you or you need further assistance on this matter.
Looking forward for your reply.