namespace CSharp.SilverlightDemo
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.ServiceModel;
    using System.Windows;
    using System.Windows.Browser;
    using System.Windows.Controls;
    using Telerik.Reporting.Service.SilverlightClient;
    using Telerik.Reporting.Service;
    using Telerik.ReportViewer.Silverlight;
    using System.Windows.Media;

    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void ReportViewer1_RenderBegin_3(object sender, RenderBeginEventArgs args)
        {
            args.ParameterValues["Parameter1"] = "render begin value";
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            var layoutRoot = (FrameworkElement)VisualTreeHelper.GetChild(this.ReportViewer1, 0);
            var viewerModel = (ReportViewerModel)layoutRoot.DataContext;
            viewerModel.ApplyReportParametersCommand.Execute(null);
            viewerModel.PrintReportCommand.Execute(null);
        }


    }
}
