You can print the SfDataGrid with Header and Footer content by using PrintPageHeaderTemplate and PrintPageFooterTemplate properties in SfDataGrid.PrintSettings. By default, SfDataGrid prints without Header and Footer content.
The following code example explains the Footer data template definition for SfDataGrid. While printing, the data template is set to ContentControl in PrintPreviewAreaControl. From PrintPreviewAreaControl, you can access the following properties by using Ancestor binding in the data template.
In the above code example, TodayDate is a normal CLR property in the type of DateTime that is used to store today’s date by using DateTime.Today.
The following code example explains how to set Footer Data Template to PrintSettings.PrintPageFooterTemplate in SfDataGrid.
Note: Using the same method, you can also set PrintPageHeaderTemplate while printing.
The following screenshot displays the print preview of SfDataGrid with Header and Footer.
You can refer to the sample from the following location.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:||.NET Framework:|
or the page will be automatically redirected to sign-in page in 10 seconds.