Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a datagrid in which data is loaded from mysql.

XML
<DataGrid AutoGenerateColumns="True" FontSize="15" FontFamily="Times New Roman" FontWeight="Bold" Height="271" HorizontalAlignment="Center" HorizontalScrollBarVisibility="Auto" Margin="12,303,13,12" Name="dataGrid1" VerticalAlignment="Center" VerticalScrollBarVisibility="Auto" Width="953" Background="AliceBlue" AlternatingRowBackground="#FFEBCF91" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" />


This have a long list of data with many columns. I just want to print the whole content of this grid as it is. When i am trying, it is only printing visible data by printdailog. How to print all the data.

Thanks in advance
Posted

1 solution

Try to print the collection itself rather than printing the grid.
 
Share this answer
 
Comments
Member 11475637 19-Sep-15 11:36am    
Thanks for your prompt action. But can you alaborate how?? i am new to wpf.

private void btnPrint_Click(object sender, RoutedEventArgs e)
{
PrintDialog printDlg = new PrintDialog();
if (printDlg.ShowDialog() == true)
{

printDlg.PrintVisual(dataGrid1, "A WPF printing");


}

}
Abhinav S 19-Sep-15 12:21pm    
Member 11475637 19-Sep-15 12:37pm    
I already show that but doen't help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900