Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
295
xamreportviewer
posted

Hello Team,

xamReportViewer must display the report and after few seconds lets say -10secs , it should be automatically refresh to update the view. Report will get the data from database.

How to implement this in MVVM using c#?

Parents
No Data
Reply
  • 17475
    Offline posted

    Hello,

    You can bind the data in your viewmodel to your report using the DataSources collection of the ClientRenderSettings. Check this document for sample code of how to bind a data sources through the viewer API.

    Here are the steps that need to be followed:

    1.    Create the report, define a data source and associate it to the item you want to render.
    2.    In your application, add the XamReportViewer and configure it to render the report you have created.
    3.    Configure the DataSources property to bind to data in your viewmodel.

    <ig:XamReportViewer>
      <ig:XamReportViewer.RenderSettings>
        <ig:ClientRenderSettings DefinitionUri="MyApp;component/Report.igr, MyApp" >                
          <ig:ClientRenderSettings.DataSources>                   
            <ig:DataSource TargetDataSource="YourData" ItemsSource="{Binding yourDataProperty}" />                  
          </ig:ClientRenderSettings.DataSources>            
        </ig:ClientRenderSettings>
    </ig:XamReportViewer>

    Where YourData is the data source you have defined and yourDataProperty is a property in the viewmodel.

Children