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