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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to print specific or group of rows in the SfDataGrid?

Platform: WPF |
Control: SfDataGrid |
.NET Framework: 4.5
Tags: printing

In the SfDataGrid, it is not possible to print the group of rows, by default. However, it can be achieved by deriving new class from the GridPrintManager class.

In the derived CustomPrintManager class, you can override the GetSourceListForPrinting method. Return the Selecteditems by using Selecteditems.ToList as shown in following code example.


   //CustomPrintManager Class
    internal class CustomPrintManager : GridPrintManager
        //CustomPrintManager class constructor
        public CustomPrintManager(SfDataGrid grid)
            : base(grid)
        //Overrides the GetSourceListForPrinting method 
        protected override IList GetSourceListForPrinting()
         return this.dataGrid.SelectedItems.ToList();        

You can assign the instance of that customized CustomPrintManager class to DataGrid.PrintSettings.PrintManagerBase property as shown in the following code example.


//Assigns the CustomPrintManager class to grid.PrintSettings.PrintManagerBase
this.syncgrid.PrintSettings.PrintManagerBase=new  CustomPrintManager(syncgrid);


Sample Links




2X faster development

The ultimate WPF UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile