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

Silverlight ReportViewer ZoomMode ZoomPercent?

3 Answers 151 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Gary C
Top achievements
Rank 1
Gary C asked on 17 Feb 2010, 08:39 PM
Hello,

I don't see the the ZoomMode and ZoomPercent properties for the Silverlight ReportViewer? Do they exist? Do they have different names? Are there equivalent properties I should be looking at?

Thanks,

-Gary

3 Answers, 1 is accepted

Sort by
0
Svetoslav
Telerik team
answered on 19 Feb 2010, 09:01 AM
Hi Gary,

The Silverlight report viewer is built on top of the latest architectural design patterns and follows closely the M-V-VM principles. As such its UI (view) is entirely separated from any managing logic through the ReportViewerModel (the view model). The ReportViewerModel is available through the controls' DataContext.

Anyway, how the Silverlight report viewer scales the report pages is controlled through the ReportViewerMode.Zoom property.

For additional information please see the Silverlight Report Viewer API.

I hope this information helps.

Greetings,
Svetoslav
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Gary C
Top achievements
Rank 1
answered on 22 Feb 2010, 10:28 PM

Hello Svetoslav,

 

Thanks very much for your response, that works as you described. I have a couple related follow-up question on this topic. For our requirement, we need to initially show a specific Zoom percent for our report viewer that depends on the size of the container form (to clarify, we want to mimic the "Page Width"/"Whole page" behavior from the WinForms ReportViewer). We have our sizing logic almost working when the report viewer’s container is resized. One problem is getting our sizing logic called when the report viewer is initially shown (because the SizeChanged event won’t be called until the container is resized).

 

1. Is there an event available on the ReportViewer that we can hook to so our sizing logic gets called before the report is shown?

2. We are using the PageWidth and PageHeight properties of the ReporViewerModel, but we are adjusting those values in hopes to better size the actual report content window to the proper zoom level. We'd like to know if there is a better way/property to get the portion of the report viewer that contains the actual report (minus toolbar etc)?

See code:

private void FitReportToViewer()
{
    double containerWidth = rvReport.ActualWidth;
    double containerHeight = rvReport.ActualHeight;
    double reportPageWidth = (rvReport.DataContext as ReportViewerModel).PageWidth;
    double reportPageHeight = (rvReport.DataContext as ReportViewerModel).PageHeight;
    double currentScale = (rvReport.DataContext as ReportViewerModel).Zoom;
    double marginlessPageWidth = reportPageWidth + (120 * currentScale);
    double marginlessPageHeight = reportPageHeight + (420 * currentScale);

    if (_reportInfo != null && reportPageWidth > 10)
    {
        if (_reportInfo.Report.ReportItems[0].ItemType == ItemTypes.Table)
        {
            //page width
            (rvReport.DataContext as ReportViewerModel).Zoom = (containerWidth / (marginlessPageWidth / currentScale));
        }
        else
        {
            //whole page
            if (reportPageWidth >= reportPageHeight)
            {
                // landscape
                (rvReport.DataContext as ReportViewerModel).Zoom = (containerWidth / (marginlessPageWidth / currentScale));
            }
            else
            {
                // portrait
                (rvReport.DataContext as ReportViewerModel).Zoom = (containerHeight / (marginlessPageHeight / currentScale));
            }
        }
    }
}


Thanks,

-Gary

0
Svetoslav
Telerik team
answered on 26 Feb 2010, 09:50 AM
Hello Gary C,

I'm not sure I understand your first question. Anyway for complete information on the Silverlight ReportViewer please see Telerik.ReportViewer.Silverlight Namespace in the documentation.

Regarding your second question - please see the Creating Style in Expression Blend topic that describes how to create a copy of the control template. This way you may handle the entire viewer layout according to your particular needs.

Regards,
Svetoslav
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Gary C
Top achievements
Rank 1
Answers by
Svetoslav
Telerik team
Gary C
Top achievements
Rank 1
Share this question
or