Skip to content

SyncfusionExamples/how-to-set-the-indentcolumnwidth-when-print-the-uwp-datagrid

Repository files navigation

How to Set the IndentColumnWidth When Print the UWP DataGrid?

This example illustrates how to set the IndentColumnWidth when print the UWP DataGrid (SfDataGrid).

DataGrid 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,

DataGrid with the IndentColumnWidth set as 0 while printing

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

DataGrid with the IndentColumnWidth set as 20 while printing

About

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

Topics

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages