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

Reporting in MVVM pattern

1 Answer 86 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ricky
Top achievements
Rank 1
Ricky asked on 20 May 2013, 11:46 PM
Hi there,

I have an existing view with an view model as the data context, I am adding a report (Telerik Reporting 2013Q1) to the page, I use one of the public properties of the viewmodel as the data source (it's a list of object), but the report is empty seems like there is no data, here is some code:

1. the view
<tr:ReportViewer Name="ReportViewerStrats" ReportSource="{Binding DataContext.ReportSource, ElementName=StratsView}"/>

2. the property view model
private List<MyItem> _myItems;
public List<MyItem> MyItems
{
    get { return _myItems; }
    set
    {
        _myItems = value;                
        base.OnPropertyChanged("MyItems");
    }
}

3. the initialize in view mode:
MyItems = GetItems();   //Get from database
ReportSource = new MyReport();


And finally the report is attached. In debug mode, I check the view model (MyItems) does have data.

thanks.

--ricky

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 21 May 2013, 03:57 PM
Hi Ricky,

We have reviewed the provided code snippets and noticed that you have omitted to databind the report definition. For more information check out the ObjectDataSource Component help articles.

Kind regards,
Peter
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

Tags
General Discussions
Asked by
Ricky
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or