We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to print SfDataGrid with Header and Footer?

You can print the SfDataGrid with Header and Footer content using PrintPageHeaderTemplate and PrintPageFooterTemplate properties in SfDataGrid.PrintSettings. By default, SfDataGrid prints without Header and Footer content.

The following XAML code example displays the Footer DataTemplate definition for SfDataGrid. While printing, this data template sets the ContentControl in PrintPageControl. From PrintPageControl, you can access the following properties using Ancestor binding in the data template.

  1. PageIndex – denotes the current page index that is printing.
  2. TotalPages – Total number of pages to be printed.

It is also possible to display and print the current DateTime using DateTime.Today as displayed in the following code example.

XAML

The following code example displays how to set Footer DataTemplate (the above one) to PrintSettings.PrintPageFooterTemplate in SfDataGrid

C#

 

Note: Using the same way, you can set PrintPageHeaderTemplate also while printing.

The following screenshot displays the print preview of SfDataGrid with Header and Footer.

C:\Users\arshiazeba\Desktop\del.png

 

Sample Links:

WPF

WRT

UWP

 

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework:
6138 01/27/2016 01/27/2016 UWP SfDataGrid 4.5
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon