I have DataGrid that needs to be printed in multiple pages both horizontally and vertically. Based on exhaustive searching the closest solution i have is the one found @http://www.codeproject.com/Articles/138233/Custom-Data-Grid-Document-Paginator. However, if DataGridTemplateColumn having ComboBox as its content is printed, the resultant print output is blank combobox. Below is the screenshot of the print,
http://www.filedropper.com/datagridprint
Below is the code used to create a template column while printing,
private FrameworkElement GetTableCell(Grid grid, DataGridColumn column, object item, int columnIndex, int rowIndex)
{
FrameworkElement visualElement = null;
if (column is DataGridTemplateColumn)
{
DataGridTemplateColumn templateColumn = column as DataGridTemplateColumn;
ContentControl contentControl = new ContentControl();
contentControl.Focusable = true;
contentControl.ContentTemplate = templateColumn.CellTemplate;
contentControl.Content = item;
contentControl.SetValue(Grid.ColumnProperty, columnIndex);
contentControl.SetValue(Grid.RowProperty, rowIndex);
visualElement = contentControl;
}
The above code basically creates new content control and adds the CellTemplate associated with the grid to the newly created content, which does not work. I would like to know if there is a fix for the above code, if not, is there a working solution that would print DataGrid into multiple pages (WYSIWYG).
Thanks for your help.