Articles in this section

How to set the IndentColumnWidth when print the UWP DataGrid (SfDataGrid)?

SfDataGrid allows you to set IndentColumnWidth while printing. You can achieve this by set the IndentColumnWidth property by override the GridPrintManager in PrintManagerBase class.

private void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{          
            if (dataGrid != null)
            {   
        dataGrid.PrintSettings.AllowPrintStyles = true;              
                dataGrid.PrintSettings.PrintManagerBase = new CustomPrintManager(dataGrid);
                dataGrid.PrintSettings.PrintManagerBase.Print();
            }
}
 
public class CustomPrintManager : GridPrintManager
{
        private double indentColumnWidth = 0;
        public SfDataGrid sfDatagrid;
        public CustomPrintManager(SfDataGrid grid)
            : base(grid)
        {
            sfDatagrid = grid;
            IndentColumnWidth = indentColumnWidth;
        }       
}

The following screenshot illustrates the IndentColumnWidth set as 0 while printing,

IndentColumnWidth set as 0 while printing in SfDataGrid

The following screenshot illustrates the IndentColumnWidth set as 20 while printing,

IndentColumnWidth set as 20 while printing in SfDataGrid

View Sample in GitHub

 

 

 

 

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