Hello,
I have a TreeListView with a button to export to excel. At the time of exporting, I'd like to modify cell content slightly, based on properties of the underlying data context of the grid row that is being exported. However, it appears that in the ElementExporting event, there is no way to get the current row (or DataContext of the current Row).
Any suggestions?
Here is an example of what I would like to do:
I have a TreeListView with a button to export to excel. At the time of exporting, I'd like to modify cell content slightly, based on properties of the underlying data context of the grid row that is being exported. However, it appears that in the ElementExporting event, there is no way to get the current row (or DataContext of the current Row).
Any suggestions?
Here is an example of what I would like to do:
private
void
grd_ElementExporting(
object
sender, GridViewElementExportingEventArgs e)
{
if
(e.Element == ExportElement.Cell)
{
if
(e.Context
is
GridViewDataColumn && ((GridViewDataColumn)e.Context).DisplayIndex == 0)
{
MyDataItem item = e.Item
as
MyDataItem;
//Pseudo code - this is what I would like to do...
if
(item.IsImportant)
e.Value =
"***"
+ e.Value +
"***"
;
}
}
}