Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
PrintPreview - alignment of summary columns in nested group by rows shifted
posted

Hi,

For some reason, summary columns in nested group by rows are not aligned properly when the grid is displayed in a PrintPreview window or printed out - i.e. the columns are all shifted to the right (relative to the rows indentation). At the same time the alignment is correct in the grid itself.

The following code creates the PrintPreview of the grid in question - and snapshots to illustrate the problem.

Do you know how I can force the nested group by rows to keep the correct alignment for the summary columns? Is there some property that I am missing that would enforce the alignment? Or do I need to remove the row indentations to prevent the columns to be shifted?

Thanks for your help, Anita

-----------

Report report = new Report();

//where grid is an intance of XamDataGrid
EmbeddedVisualReportSection section = new EmbeddedVisualReportSection( grid );  
report.Sections.Add( section );

report.PageHeaderTemplate = Resources[ "PagePresenterHeaderTemplate" ] as DataTemplate;
report.PageFooterTemplate = Resources[ "PagePresenterFooterTemplate" ] as DataTemplate;

report.PageHeader = title;
report.ReportSettings.HorizontalPaginationMode = HorizontalPaginationMode.Scale;

//where viewer is an instance of XamReportPreview
viewer.GeneratePreview( report, false, true );

----------------

As displayed in PrintPreview - nested summary columns shifted to right by identation:

As displayed correctly in the grid itself:

Parents
  • 12875
    posted

    HI,

    I can see the way the way the summaries line up in your grid and in the print preview but I need more  information about how you are creating the summaries in the grid.  It would be helpful to have a small sample. 

    What version of NetAdvantage are you using?  And what service release version?

     

  • 40
    posted in reply to [Infragistics] Marianne

    I am using NetAdvantage_WPF_20103, ie:
    Version: 10.3.20103.1003
    Runtime version: v4.0.30319

    Simple example displaying the same behaviour below.

    Main Window displaying the grid:

    <Window x:Class="ProcTest.MainWindow"
            xmlns="
    http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525" xmlns:igDP="http://infragistics.com/DataPresenter" Loaded="Window_Loaded">
        <DockPanel LastChildFill="True">
            <Button Name="m_preview" Content="Preview" DockPanel.Dock="Bottom" Width="60" Margin="5" Click="m_preview_Click"    />
            <igDP:XamDataGrid Name="m_grid" />
        </DockPanel>
    </Window>

    namespace ProcTest
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();

                m_grid.DataSource = GetData().DefaultView;
            }

            private void Window_Loaded( object sender, RoutedEventArgs e )
            {
                FieldLayout field_layout = m_grid.FieldLayouts[ 0 ];

                foreach( Field field in field_layout.Fields )
                {
                    if( field.DataType == typeof( Double ) )
                    {
                        SummaryDefinition summary = new SummaryDefinition();

                        summary.Calculator = null;
                        summary.Key = field.Name;
                        summary.SourceFieldName = field.Name;
                        summary.Calculator = SummaryCalculator.Sum;

                        field_layout.Settings.GroupBySummaryDisplayMode = GroupBySummaryDisplayMode.SummaryCellsAlwaysBelowDescription;

                        field_layout.SummaryDefinitions.Add( summary );
                    }
                }
            }

            private void m_preview_Click( object sender, RoutedEventArgs e )
            {
                Preview viewer = new Preview();

                viewer.PrintPreview( m_grid );
            }

     

            private DataTable GetData()
            {
                DataTable data = new DataTable();

                DataColumn col1 = new DataColumn( "date", typeof( DateTime ) );
                DataColumn col2 = new DataColumn( "desc", typeof( string ) );
                DataColumn col3 = new DataColumn( "n1", typeof( double ) );
                DataColumn col4 = new DataColumn( "n2", typeof( double ) );
                DataColumn col5 = new DataColumn( "n3", typeof( double ) );

                data.Columns.Add( col1 );
                data.Columns.Add( col2 );
                data.Columns.Add( col3 );
                data.Columns.Add( col4 );
                data.Columns.Add( col5 );

                for( int j = 0; j < 3; ++j )
                {
                    DateTime date = DateTime.Today.AddDays( j );
                    string desc = "test" + j;

                    for( int i = 0; i < 3; ++i )
                    {
                        DataRow row = data.NewRow();
                        row[ col1 ] = date;
                        row[ col2 ] = desc;
                        row[ col3 ] = i;
                        row[ col4 ] = i + 10;
                        row[ col5 ] = i * 10;

                        data.Rows.Add( row );
                    }
                }

                return data;
            }

        }
    }

    Print Preview window:

    <Window x:Class="ProcTest.Preview"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="Preview" Height="300" Width="300" xmlns:igReporting="http://infragistics.com/Reporting">
        <DockPanel>
            <igReporting:XamReportPreview Name="m_preview" />
        </DockPanel>
    </Window>

    namespace ProcTest
    {
        /// <summary>
        /// Interaction logic for Preview.xaml
        /// </summary>
        public partial class Preview : Window
        {
            public Preview()
            {
                InitializeComponent();
            }

            public void PrintPreview( XamDataGrid grid )
            {
                Report report = new Report();

                EmbeddedVisualReportSection section = new EmbeddedVisualReportSection( grid );

                report.Sections.Add( section );

                m_preview.GeneratePreview( report, false, true ); 

                ShowDialog();
            }
        }
    }

    Snapshot of grid - summary columns correctly aligned:

     Snapshot of Print Preview - summary columns all shifted:

Reply Children