Articles in this section
Category / Section

How to print specific or group of rows in WinRT the DataGrid?

1 min read

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.

C#

   //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.

C#

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

 

Sample Links

WPF

WINRT

UWP

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied