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
610
XamReportPreview.GeneratesPreview Throws Exception When Themed and loaded with 2 or More DataRows
posted
We are attempting to generate a Print Preview of a XamPivotGrid which is themed with the IG theme.
Calling the XamReportPreview.GeneratesPreview method throws an Exception when the PivotGrid
meets both of the following two conditions:
a) contains 2 or more datarows and
b) the Infragistics.Windows.Reporting.EmbeddedVisualReportSection is themed with the IG theme.
If only one of the above conditions is present then the XamReportPreview.GeneratesPreview method
does not throw an exception
This problem was present as of Infragistics Build No. 16.1.20161.2033 and is still present in
Build No 16.2.20162.1006

XAML Code Snippets
-----------------
xmlns:ig="http://schemas.infragistics.com/xaml"
xmlns:igRep="http://infragistics.com/Reporting"

<igRep:XamReportPreview x:Name="xrppReportPreview" Grid.Row = "0" MinWidth="200" />
<igRep:ReportProgressControl x:Name="xprbProgress" Grid.Row="1" />

<ig:XamPivotGrid x:Name="xpvgPivotGrid" Grid.Column="1" Grid.Row="0"
 EnableAdvancedFiltering="True" AllowCompactLayout="True"
 AllowHeaderColumnsSorting="True" Margin="0,0,0,0" Padding="0"
 CellStyle="{StaticResource PivotCellStyle}"
 TotalColumnStyle="{StaticResource TotalColumnCellsStyle}"
 TotalRowStyle="{StaticResource TotalRowCellsStyle}"
 CellClicked="xpvgPivotGrid_CellClicked">
        <ig:XamPivotGrid.SelectionSettings>
            <ig:PivotSelectionSettings
   AllowRowHeaderSelection="True" CellSelection="Single"
   CellSelectionAction="SelectRow" RowSelection="Single" />
              </ig:XamPivotGrid.SelectionSettings>
              <ig:XamPivotGrid.SortingSettings>
                <ig:PivotSortingSettings AllowSorting="True"
   AllowMultipleColumnSorting="True"
   MultiSortingKey="Control" />
              </ig:XamPivotGrid.SortingSettings>
              <ig:XamPivotGrid.ReportSettings>
           <ig:PivotReportSettings x:Name="xprsReportSettings" />
        </ig:XamPivotGrid.ReportSettings>
</ig:XamPivotGrid>
Program Code Behind
-------------------
Dim loReport As New Infragistics.Windows.Reporting.Report
Dim loSection As Infragistics.Windows.Reporting.EmbeddedVisualReportSection
With loReport.ReportSettings
 .PagePrintOrder = Reporting.PagePrintOrder.Horizontal,
 .HorizontalPaginationMode = Reporting.HorizontalPaginationMode.Scale
End With
With xprsReportSettings.ColumnHeaderCellSettings
 .PrintHeaders = True
 .RepeatHeaders = True
 .PrintExpansionIndicators = False
End With
With xprsReportSettings.RowHeaderCellSettings
 .PrintHeaders = True
 .RepeatHeaders = True
 .PrintExpansionIndicators = False
End With
loSection = New Reporting.EmbeddedVisualReportSection(Me.xpvgPivotGrid)
loSection.Resources.MergedDictionaries.Add(New ResourceDictionary() _
   With {.Source = New Uri("MyApplication;component/" +
   "/Themes/IG/IG.xamPivotGrid.xaml", UriKind.RelativeOrAbsolute)})
loReport.Sections.Add(loSection)
xprbProgress.Report = loReport
xrppReportPreview.GeneratePreview(loReport, False, True)
Exception Message
-----------------
System.NullReferenceException occurred
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=InfragisticsWPF4.Controls.Grids.XamPivotGrid.v16.2
  StackTrace:
       at Infragistics.Controls.Grids.PivotReportRowHeaderCell.EnsureCurrentState()
  InnerException: