Cannot see WPF ReportViewer in either Visual Studio designer or application

1 Answer 568 Views
Report Viewer - WPF
Johnathan
Top achievements
Rank 1
Johnathan asked on 02 Nov 2021, 11:31 PM

   I'm having a problem using the Telerik Reporting WPF ReportViewer control.  I'm using Visual Studio 2017 v15.9.38 along with Telerik UI for WPF and Telerik Reporting v 15.2.21.915 (latest version).  My application is targeting .NET 4.5.2.

   In my application, I need to allow users to generate printed documents from system objects.  For example, a Purchase Order.  The user creates the Purchase Order, then needs to print it.  I'm trying to use Telerik Reporting to do this, much like other applications use embedded Crystal Reports.

   My application stores the reports as a byte array/varbinary in an MSSQL database.  To test, I copied the sample Invoice report, and removed all data sources and everything except a simple line of text and image to make sure it renders.  Later on I plan on adding data sources and binding those to internal system objects.  My application handles the uploading of the report document and pulls it from the database and generates a Telerik.Reporting.InstanceReportSource before showing it.

        Dim rsTelerik As New Telerik.Reporting.InstanceReportSource
        Dim rPack As New Telerik.Reporting.ReportPackager

            rsTelerik.ReportDocument = rPack.UnpackageDocument(New MemoryStream(MyByteArray))

   This all seems to work fine.  To display the report I have a custom control that hosts the Telerik ReportViewer and passes the ReportSource via DataBinding with a DependencyProperty.  I've made it extremely simple just to test things.

<base:TBaseUserControl

             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:tr="http://schemas.telerik.com/wpf" 
             xmlns:localcontrols="clr-namespace:Redstone.Controls"
             xmlns:base="clr-namespace:Redstone.Controls"
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="400"
        >

    <tr:ReportViewer x:Name="rptViewer" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type base:CtrlTelerikReportBinding}}}">
        <tr:ReportViewer.ReportSource>
            <Reporting:InstanceReportSource x:Name="rsInstance"/>
        </tr:ReportViewer.ReportSource>
    </tr:ReportViewer>
</base:TBaseUserControl>

   However the Visual Studio designer shows the ReportViewer control as a completely blank and transparent object.  See attached screenshot.  I've verified that I have references to both Telerik.Reporting and Telerik.ReportViewer.Wpf, and I verified that the References are set to copy local.  I dragged and dropped the report control to let it create the references.  I also verified that my Application.xaml has the Resource Dictionaries:

        <ResourceDictionary x:Key="keuUI">
            <ResourceDictionary.MergedDictionaries>
                <ui:ThemeResources />
                <ui:XamlControlsResources />
                <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/System.Windows.xaml" />
                <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.Windows.Controls.xaml" />
                <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.Windows.Controls.Input.xaml" />
                <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.Windows.Controls.Navigation.xaml" />
                <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.ReportViewer.Wpf.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

   Both the VS designer and my application show the control as completely blank and transparent.  See attached screenshot from the application.  I tried uninstalling and re-installing the Telerik Reporting module, but still have the same issue.  I get information in the Output window about the control loading and some warnings about a Telerik XML package, but no errors.  I'm guessing that this is some kind of error with the References or DLLs since the designer won't show the control either.  Any suggestions?

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 05 Nov 2021, 10:48 AM

Hello Johnathan,

Thank you for the provided information and screenshots!

The WPF ReportViewer control uses implicit styles. When the viewer's template (Telerik.ReportViewer.Wpf.xaml) file is not loaded correctly, the viewer is not displayed. Double-check if XAML resources are loaded in the application.

More details about the settings required by the WPF ReportViewer are available in WPF ReportViewer: Manual Setup.

Other possible causes for the issue are described in the following article: Missing Controls in the UI.

Additionally, I recommend having a look at the The WPF/Silverlight report viewer is blank KB article.

Note that generally, we recommend adding a WPF report viewer to a project through our Item template for the WPF viewer, please check out the How to Add report viewer to a WPF .NET Framework project article.

There are also the demos that we provide, I strongly recommend checking out how the CSharp.NetFramework.WpfIntegrationDemo is set up and making sure you have the same references in your project. If you have installed the product with the default settings, the demos solution should be at the following path:

C:\Program Files (x86)\Progress\Telerik Reporting R3 2021\Examples\CSharp

Please let me know if you have any other questions or need further assistance.

Regards,
Dimitar
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Johnathan
Top achievements
Rank 1
commented on 19 Jan 2022, 08:29 PM

   I finally had a chance to follow-up on these suggestions, but I'm still having problems.  To make things easier, I have created a brand-new simple, basic project in Visual Studio 2017.  I am creating a Visual Basic WPF App (.Net Framework) project targeting .NET 4.6.1.  No other changes, one window.

   After creating the new project and saving it, I am attempting to follow the instructions you linked to:  https://docs.telerik.com/reporting/using-reports-in-applications/display-reports-in-applications/wpf-application/how-to-add-report-viewer-to-a-wpf-.net-framework-project  .  Those say that the easiest way to add all the dependencies is to add a new Telerik Report Viewer Window item.  I right-click on my project and choose add new item, but I do not have such an option:

   If I choose a Telerik Report R1 2022 (Blank) item, it's added correctly, and the control shows up properly:

   However, I don't want to add a report, I want to add a report viewer control.  If I use the toolbox to add a report viewer control to my existing window, I get the same problem I had in my main project, the control is not visible:

   This is a brand-new project and has no other changes.  The control simply isn't rendering.  The dependencies for the viewer are supposed to be added by the add new report viewer window, but that doesn't seem to exist.  I would prefer not to manually add the references because that seems to be hideously complicated for these tools for some reason.  

   I am now running the latest version of Visual Studio 2017, v15.9.43.  I've updated the Progress/Telerik controls to the latest version using the Progress Control Panel.  Looks like it's Reporting R1 2022.  I'm running Windows 10 Pro, fully patched.  

 

Dimitar
Telerik team
commented on 24 Jan 2022, 01:48 PM

Indeed, the easiest way to add the WPF report viewer in a .NET application is through the Item template.

It is strange that the WPF Report Viewer template is not appearing in the Add New Item window. On image 2, if you type Telerik in the search bar, do you again see only the report templates? It is strange that the report templates are present but the others are not.

Please try to install the Telerik Reporting extension for your Visual Studio 2017 again - Telerik Reporting Missing in Visual Studio.

Also, make sure that the Telerik Reporting tools are enabled in VS - Missing Telerik menu in Visual Studio.

If nothing helps, please try to install the product again, however, this time try to not do it through the Progress Control panel. Instead, download the MSI for Telerik Reporting from your Telerik account. Make sure that all VS instances are closed before running the installer, the same goes for the approach from the KB article above. If you end up installing the whole product anew, you may as well generate an install log to see why the templates are not present - Troubleshoot Telerik Reporting installation problems.

Tags
Report Viewer - WPF
Asked by
Johnathan
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or