This is a migrated thread and some comments may be shown as answers.

Reporting Q1 2016 - WPF - UriReportSource

2 Answers 99 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 08 Apr 2016, 10:50 AM

Hello,

I have a very simple scenario where I want to load a report created with the standalone designer in a WPF ReportViewer.

[Code Behind for Main Window]

            InitializeComponent();
            ReportViewer1 = new Telerik.ReportViewer.Wpf.ReportViewer();
            Telerik.Reporting.UriReportSource uriReportSource = new Telerik.Reporting.UriReportSource();
            uriReportSource.Uri = @"./yop.trdx";
            this.ReportViewer1.ReportSource = uriReportSource;
            ReportViewer1.RefreshReport();

 

The ReportViewer is shown with the correct theme but the specified report (yop.trdx) failed to load. The report has only a static textbox in it (no datasource bindings)

My xaml look like:

<Window x:Class="App2.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                xmlns:tr="http://schemas.telerik.com/wpf"
                xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
                Title="MainWindow" Height="350" Width="525"   telerikControls:StyleManager.Theme="Vista">
             <Grid>
        <tr:ReportViewer x:Name="ReportViewer1" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch"/>
    </Grid>

 

Could you please help me?

Thanks,

Thomas

 

2 Answers, 1 is accepted

Sort by
0
Thomas
Top achievements
Rank 1
answered on 08 Apr 2016, 11:31 AM
Never mind. Removed the ReportViewer code behind instanciation and got it working.  
0
Stef
Telerik team
answered on 11 Apr 2016, 12:22 PM
Hello Thomas,

The UriReportSource.Uri string should be a relative path to the TRDX file based on the application's execution folder, or it can be an absolute path.

Other approaches for deploying TRDX files are elaborated in How to: Deploy a report created with Standalone Report Designer. Details about the report sources used in the article - Report Sources.


I hope this information is helpful.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Thomas
Top achievements
Rank 1
Answers by
Thomas
Top achievements
Rank 1
Stef
Telerik team
Share this question
or