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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Print Row Auto Height

Thread ID:





122129 Feb 18,2016 03:05 PM UTC Feb 23,2016 01:09 PM UTC WPF 3
Tags: SfDataGrid
Asked On February 18, 2016 03:05 PM UTC

Hello Sir,

How to set the row auto height when print from SfDataGrid ?

I manage to set the SfDataGrid row auto height but not for print preview and print.

Please see attached for more info .

Thank you.


Attachment: SfDataGrid_fa99aa74.zip

Jayapradha S [Syncfusion]
Replied On February 19, 2016 12:33 PM UTC

Hi Yapwen, 

Thank you for contacting Syncfusion Support.

You can achieve your requirement by overriding the GridPrintManager Class and GetRowHeight method as shown below,

Code Example:

syncgrid.PrintSettings.PrintManagerBase = new CustomPrintManager(this.syncgrid);

public class CustomPrintManager : GridPrintManager


        SfDataGrid dataGrid;

        GridRowSizingOptions gridRowSizingOptions = new GridRowSizingOptions();

        double Height = double.NaN;

        public CustomPrintManager(SfDataGrid grid)

            : base(grid)


            dataGrid = grid;           



        protected override double GetRowHeight(object record, int rowindex)


            if(record != null)


                var actualrowindex = GridIndexResolver.ResolveToRowIndex(this.dataGrid, rowindex);

                if (this.dataGrid.GridColumnSizer.GetAutoRowHeight(actualrowindex, gridRowSizingOptions, out Height))


                    return Height;



            return base.GetRowHeight(record, rowindex);



In GetRowHeight method we have resolved rowindex using ResolveToRowIndex. Since GetRowHeight method receives the RecordIndex value. We will fix this issue in our upcoming release to pass rowindex, so you do not have to use ResolveToRowIndex.

Please find the sample from the following location,
Sample Link: http://www.syncfusion.com/downloads/support/forum/122129/ze/PrintingDemo-142227675

Please refer the below UG doc to customize the GridPrintManager,
UG Link: http://help.syncfusion.com/wpf/sfdatagrid/printing#printing-customization 


Replied On February 23, 2016 02:36 AM UTC

Dear jaya,

Thank you very much.


Sowndaiyan Paulpandi [Syncfusion]
Replied On February 23, 2016 01:09 PM UTC

Hi Yapwen, 

Thanks for the update.

Please let us know if you need further assistance.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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