Problem statement -
WPF Datagrid is formatted with
LoadingRow="DataGrid_OnLoadingRow"
1.Datagrid on full page (100 Rows)
2.Condition rows ID < 50 then cell = light green
else cell = blue
Now when i tried to export the excel, the cell formatted properly.
it is not correctly exporting.it skips rows or alter colors.
the same grid work with 20 rows where i split condition to 10(lightgreen)-10(blue) working perfect with exporting.
What I have tried:
What i tried :
Loop through DataGrid.
1.
public static System.Windows.Controls.DataGridCell GetCell(System.Windows.Controls.DataGrid host, DataGridRow row, int columnIndex)
Copy Cell content to Object
2.xCell =
.ItemContainerGenerator.ContainerFromIndex(rowIndex);
OR
3. xCell =
.ItemContainerGenerator.ContainerFromItem(xDataRow);
4. Also tried
dataGrid.UpdateLayout();
dataGrid.ScrollIntoView(Ldgv.Items[rowIndex]);
5. apply that style to excel cell
the Datagrid formatted correctly. and export perfectly with colors if only of less records which is not required scrolling.
i need to develop one open source datagrid for other developers
which export with same font and colors for any number of rows formatted.