I am using the most-current version of Telerik Reporting. I am testing with a very simple MVVM solution. The report only has a report header page with a text block in it. I have the report viewer in the main window and bound to the reportsource in the viewmodel. The report will not display. I have looked at several examples and do this same thing but none work for me.
public class MainWindowViewModel : ViewModelBase { private string MessageValue = "Nothing to see here..."; public string Message { get => MessageValue; set { MessageValue = value; RaisePropertyChanged(); } } private Telerik.Reporting.ReportSource ReportValue; public Telerik.Reporting.ReportSource Report { get => ReportValue; set { ReportValue = value; RaisePropertyChanged(); } } public void RunReport() { Message = "Begin report run..."; Task.Run(() => { System.Threading.Thread.Sleep(5000); App.Current.Dispatcher.BeginInvoke(new Action(() => { var rs = new Telerik.Reporting.InstanceReportSource() { ReportDocument = new Report1() }; this.Report = rs; Message = "Report complete."; })); }); } }
<Window x:Class="ReportingTest.MainWindow" xmlns:local="clr-namespace:ReportingTest" xmlns:telerik="http://schemas.telerik.com/wpf" DataContext="{Binding MainWindowViewModel, Source={StaticResource ModelLocator}}" mc:Ignorable="d" Loaded="Window_Loaded" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries /> </ResourceDictionary> </Window.Resources> <Grid x:Name="LayoutRoot"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <TextBlock Grid.Row="0" Height="25" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Message}" /> <telerik:ReportViewer Grid.Row="1" ViewMode="PrintPreview" VerticalAlignment="Stretch" ReportSource="{Binding Report}" HorizontalAlignment="Stretch" /> </Grid></Window>