LightSwitch Report Viewer Custom Control

2 posts, 0 answers
  1. Jack Helfrich
    Jack Helfrich avatar
    10 posts
    Member since:
    Feb 2009

    Posted 09 Feb 2015 Link to this post

    I have a LightSwitch application originally written in Visual Studio 2012 with Telerik Reporting Q3 2013. I created a custom control as a container to hold the Report Viewer. I have created many reports, and the Report Viewer successfully renders all of the reports at run-time.

    I recently upgraded Telerik Reporting to Q3 2014 SP1 and also upgraded the reports.. The Report Viewer is now blank in the custom control, and all of the reports at run-time just display a blank screen and never generate a report. I have re-created the custom control, and there's still no report viewer. When I reverted back to Q3 2013, deleted the custom control, re-created the control, and Report Viewer displays fine and renders the reports at run-time.

    When I preview the reports in the designer, they render just fine.

    The XAML for both versions is:

    <UserControl x:Class="LongFormCtrls.ReportViewer"
        d:DesignHeight="300" d:DesignWidth="400">

        <Grid x:Name="LayoutRoot" Background="White">
            <my:ReportViewer x:Name="reportViewer1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ZoomMode="PageWidth"
             Report="{Binding Value}"/>

    Is there a reason why the Report Viewer will not work in Q3 2014 SP1?

    Thank you,
  2. Stef
    Stef avatar
    3610 posts

    Posted 11 Feb 2015 Link to this post

    Hello Jack,

    As of Q1 2014 the WPF/Silverlight ReportViewer uses implicit styles instead of the StyleManager to apply themes. 

    The only files part of Telerik Reporting are the Telerik.ReportViewer.SIlverlight.dll and Telerik.ReportViewer.SIlverlight.xaml. The rest files should be updated from the UI for SIlverlight product folder. Note it is not required to use NoXAML binaries of Telerik UI for SIlverlight. For more details about the viewer's styles, please check Setting a theme of the WPF/Silverlight Report Viewer (Q1 2014 and later) and How to: Add report viewer to a Silverlight application.

    The XAML file for the viewer must be copied from C:\Program Files (x86)\Telerik\Reporting Q3 2014\Silverlight\Themes (only Telerik.ReportViewer.Silverlight.xaml). The rest XAML files must be copied from Telerik UI for Silverlight product folder - C:\Program Files (x86)\Telerik\UI for Silverlight Q3 2014\Themes.Implicit (the same applies for the Binaries.NoXaml assemblies of Telerik UI for Silverlight).

    In case you have not purchased Telerik UI for SIlverlight, you can use the XAML resources from C:\Program Files (x86)\Telerik\Reporting Q3 2014\Silverlight\Themes and the assemblies from the local demos installed by default under C:\Program Files (x86)\Telerik\Reporting Q3 2014\Examples\CSharp\SilverlightDemo.
    Note that Telerik Reporting and Telerik UI for SIlverlight versions are synchronized - Upgrade Path Q3 2014 SP1.

    In general, the Silverlight ReportViewer can be used in Silverlight projects, where LightSwitch projects are not officially supported. Still the viewer can be used in such projects with additional settings:
    • Make sure Telerik.ReportViewer.Silverlight.xaml is added from Telerik Reporting folder, and the rest XAML files are copied from Telerik UI for Silverlight product folder. The reason is that XAML files are synchronized with the specific UI for Silverlight assemblies, and mixing the version XAML and DLLs may break the application.
    • Declare the resource dictionaries in the control's code behind to be sure they will be loaded in the LightSwitch project:
      public partial class MyReportViewerWrapper : UserControl
          public MyReportViewerWrapper()
                  Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
                      Source = new Uri("/ViewerProjectAssemblyName;component/Themes/System.Windows.xaml", UriKind.RelativeOrAbsolute)
                  Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
                      Source = new Uri("/ViewerProjectAssemblyName;component/Themes/Telerik.Windows.Controls.xaml", UriKind.RelativeOrAbsolute)
                  Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
                      Source = new Uri("/ViewerProjectAssemblyName;component/Themes/Telerik.Windows.Controls.Input.xaml", UriKind.RelativeOrAbsolute)
                  Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
                      Source = new Uri("/ViewerProjectAssemblyName;component/Themes/Telerik.Windows.Controls.Navigation.xaml", UriKind.RelativeOrAbsolute)
                  Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
                      Source = new Uri("/ViewerProjectAssemblyName;component/Themes/Telerik.ReportViewer.Silverlight.xaml", UriKind.RelativeOrAbsolute)
    I hope the provided information is helpful.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top