Content-Length: 189729 | pFad | http://docs.telerik.com/reporting/api/Telerik.ReportViewer.WPF.ReportViewer

Class ReportViewer - Telerik Reporting API Reference Documentation
skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Test Studio Dev Edition Telerik JustMock

    CMS

    Sitefinity

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Use Reports in Applications
    • System Requirements
    • Forums
    • Videos
    • Blogs
    • Submit a Ticket
    • FAQs
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now
Search all

Class ReportViewer

Represents the WPF ReportViewer control.

Inheritance
System.Object
ReportViewer
Namespace: Telerik.ReportViewer.Wpf
Assembly: Telerik.ReportViewer.Wpf.dll

Syntax

public class ReportViewer : Control

Constructors

ReportViewer()

Initializes a new instance of the ReportViewer class.

Declaration
public ReportViewer()

Fields

AllowNavigatingToFileUrlsProperty

Defines the AllowNavigatingToFileUrls property

Declaration
public static readonly DependencyProperty AllowNavigatingToFileUrlsProperty
Field Value
System.Windows.DependencyProperty

AutoDisposeModelProperty

Defines the AutoDisposeModel property

Declaration
public static readonly DependencyProperty AutoDisposeModelProperty
Field Value
System.Windows.DependencyProperty

CornerRadiusProperty

DependencyProperty for CornerRadius property.

Declaration
public static readonly DependencyProperty CornerRadiusProperty
Field Value
System.Windows.DependencyProperty

EnableAccessibilityProperty

Defines the EnableAccessibility property

Declaration
public static readonly DependencyProperty EnableAccessibilityProperty
Field Value
System.Windows.DependencyProperty

ReportEngineConnectionProperty

Defines the ReportEngineConnection property

Declaration
public static readonly DependencyProperty ReportEngineConnectionProperty
Field Value
System.Windows.DependencyProperty

ReportSourceProperty

Defines the ReportSource dependency property.

Declaration
public static readonly DependencyProperty ReportSourceProperty
Field Value
System.Windows.DependencyProperty

Remarks

The property uses TwoWay binding mode by default, hence setting another mode might not update the target.

SearchMetadataOnDemandProperty

Defines the SearchMetadataOnDemand property

Declaration
public static readonly DependencyProperty SearchMetadataOnDemandProperty
Field Value
System.Windows.DependencyProperty

TextResourcesProperty

Defines the TextResources property.

Declaration
public static readonly DependencyProperty TextResourcesProperty
Field Value
System.Windows.DependencyProperty

ViewModeProperty

Defines the ViewMode property.

Declaration
public static readonly DependencyProperty ViewModeProperty
Field Value
System.Windows.DependencyProperty

Remarks

The property uses TwoWay binding mode by default, hence setting another mode might not update the target.

ZoomModeProperty

Defines the ZoomMode property.

Declaration
public static readonly DependencyProperty ZoomModeProperty
Field Value
System.Windows.DependencyProperty

ZoomPercentProperty

Defines the ZoomPercent property.

Declaration
public static readonly DependencyProperty ZoomPercentProperty
Field Value
System.Windows.DependencyProperty

Properties

AccessibilityKeyMap

Gets or sets the accessibility key shortcuts map, used when the report viewer is in accessible mode. Returns null reference if the viewer's accessibility is not enabled.

Declaration
public Dictionary<int, ShortcutKeys> AccessibilityKeyMap { get; set; }
Property Value
System.Collections.Generic.Dictionary<System.Int32, ShortcutKeys>

AllowNavigatingToFileUrls

Gets or sets a value that determines whether the execution of NavigateToURL action that points to a file is allowed.

Declaration
public bool AllowNavigatingToFileUrls { get; set; }
Property Value
System.Boolean

Remarks

If set to false, navigating to local or network file from NavigateToUrl action will be disabled. If set to true, navigating to local or network file from NavigateToUrl action will show a confirmation window before executing the action. Default value: false

AutoDisposeModel

Gets or sets a value that indicates if the report viewer model and its resources will be automatically disposed when the window is closed.

Declaration
public bool AutoDisposeModel { get; set; }
Property Value
System.Boolean

CornerRadius

The CornerRadius property allows users to control the roundness of the corners independently by setting a radius value for each corner. Radius values that are too large are scaled so that they smoothly blend from corner to corner.

Declaration
public CornerRadius CornerRadius { get; set; }
Property Value
System.Windows.CornerRadius

CurrentPage

Gets or sets the current page in the viewer.

Declaration
public int CurrentPage { get; set; }
Property Value
System.Int32

Examples
// Navigate to a desired page
private void NavigateToPage(object sender, System.EventArgs e)
{
    var desiredPage = 5;

    // Check if the viewer can navigate to the page since the report may have fewer pages for example
    if (this.reportViewer1.CanMoveToPage(desiredPage))
    {
        // By setting the property the viewer will automatically navigate to the page in question
        this.reportViewer1.CurrentPage = desiredPage;
    }
}
' Navigate to a desired page
Private Sub NavigateToPage(sender As Object, e As System.EventArgs)
    Dim desiredPage = 5

    ' Check if the viewer can navigate to the page since the report may have fewer pages for example
    If Me.ReportViewer1.CanMoveToPage(desiredPage) Then
        ' By setting the property the viewer will automatically navigate to the page in question
        Me.ReportViewer1.CurrentPage = desiredPage
    End If
End Sub

DocumentMapVisible

Gets or sets a value that indicates whether the document map is displayed if any bookmark is defined.

Declaration
public bool DocumentMapVisible { get; set; }
Property Value
System.Boolean

Examples
' Toggle the document map
Private Sub ToggleDocumentMapVisibility(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.DocumentMapVisible = Not Me.ReportViewer1.DocumentMapVisible
End Sub
// Toggle the document map
private void ToggleDocumentMapVisibility(object sender, System.EventArgs e)
{
    this.reportViewer1.DocumentMapVisible = !this.reportViewer1.DocumentMapVisible;
}

EnableAccessibility

Gets or sets a value that indicates whether the accessibility features of the report viewer and its contents should be enabled.

Declaration
public bool EnableAccessibility { get; set; }
Property Value
System.Boolean

NavigateBackEnabled

Determines if navigate back in report viewer history operation is enabled

Declaration
public bool NavigateBackEnabled { get; }
Property Value
System.Boolean

Examples
' Navigate to the previous report in the history if available
Private Sub NavigateBack(sender As Object, e As System.EventArgs)
    If Me.ReportViewer1.NavigateBackEnabled Then
        Me.ReportViewer1.NavigateBack()
    End If
End Sub
// Navigate to the previous report in the history if available
private void NavigateBack(object sender, System.EventArgs e)
{
    if (this.reportViewer1.NavigateBackEnabled)
    {
        this.reportViewer1.NavigateBack();
    }
}

NavigateForwardEnabled

Determines if navigate forward in report viewer history operation is enabled

Declaration
public bool NavigateForwardEnabled { get; }
Property Value
System.Boolean

Examples
' Navigate to the next report in the history if available
Private Sub NavigateForward(sender As Object, e As System.EventArgs)
    If Me.ReportViewer1.NavigateBackEnabled Then
        Me.ReportViewer1.NavigateBack()
    End If
End Sub
// Navigate to the next report in the history if available
private void NavigateForward(object sender, System.EventArgs e)
{
    if (this.reportViewer1.NavigateForwardEnabled)
    {
        this.reportViewer1.NavigateForward();
    }
}

ParametersAreaVisible

Gets or sets a value that indicates whether the parameters area is displayed if any parameter editor exists.

Declaration
public bool ParametersAreaVisible { get; set; }
Property Value
System.Boolean

Examples
' Toggle the parameters area
Private Sub ToggleParametersAreaVisibility(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ParametersAreaVisible = Not Me.ReportViewer1.ParametersAreaVisible
End Sub
// Toggle the parameters area
private void ToggleParametersAreaVisibility(object sender, System.EventArgs e)
{
    this.reportViewer1.ParametersAreaVisible = !this.reportViewer1.ParametersAreaVisible;
}

RenderingExtensions

Gets the available rendering extensions list.

Declaration
public IEnumerable<RenderingExtension> RenderingExtensions { get; }
Property Value
System.Collections.Generic.IEnumerable<RenderingExtension>

ReportEngineConnection

The connection string used to configure the reporting engine that will process and render the reports.

Declaration
public string ReportEngineConnection { get; set; }
Property Value
System.String

Remarks

The connection string used to configure the reporting engine that will process and render the reports.

Examples
private void SetEmbeddedReportEngineConnection(object sender, System.EventArgs e)
{
    this.reportViewer1.ReportEngineConnection = new Telerik.ReportViewer.Common.EmbeddedConnectionInfo().ConnectionString;
    //if the ReportEngineConnection property is set to null or empty string, it will use the EmbeddedConnectionInfo by default.
}
Private Sub SetEmbeddedReportEngineConnection(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ReportEngineConnection = New Telerik.ReportViewer.Common.EmbeddedConnectionInfo().ConnectionString
    'if the ReportEngineConnection property is set to null or empty string, it will use the EmbeddedReportEngineConnectionInfo by default.
End Sub
private void SetReportServerReportEngineConnection(object sender, System.EventArgs e)
{
    this.reportViewer1.ReportEngineConnection = new Telerik.ReportViewer.Common.ReportServerConnectionInfo("http://reportserver:83", "user", "pass").ConnectionString;
}
Private Sub SetReportServerReportEngineConnection(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ReportEngineConnection = New Telerik.ReportViewer.Common.ReportServerConnectionInfo("http://reportserver:83", "user", "pass").ConnectionString
End Sub
private void SetRestServiceReportEngineConnection(object sender, System.EventArgs e)
{
    this.reportViewer1.ReportEngineConnection = new Telerik.ReportViewer.Common.RestServiceConnectionInfo("http://servicehost:83/api/reports", "authToken").ConnectionString;
}
Private Sub SetRestServiceReportEngineConnection(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ReportEngineConnection = New Telerik.ReportViewer.Common.RestServiceConnectionInfo("http://servicehost:83/api/reports", "authToken").ConnectionString
End Sub

ReportSource

Gets or sets the ReportSource for the report displayed in the viewer.

Declaration
public ReportSource ReportSource { get; set; }
Property Value
ReportSource

See Also
ReportSource
UriReportSource
TypeReportSource
InstanceReportSource
XmlReportSource

ReportViewerModel

Gets the ReportViewerModel instance.

Declaration
public IReportViewerModel ReportViewerModel { get; }
Property Value
IReportViewerModel

SearchMetadataOnDemand

Gets or sets a value that indicates whether the search metadata will be delivered on demand or by default.

Declaration
public bool SearchMetadataOnDemand { get; set; }
Property Value
System.Boolean

TextResources

Gets or sets the tooltips and the messages of the control.

Declaration
public ITextResources TextResources { get; set; }
Property Value
ITextResources

TotalPages

Gets the count of the available pages in the viewer.

Declaration
public int TotalPages { get; }
Property Value
System.Int32

Examples
' Go to the middle of the report
Private Sub GoToMiddle(sender As Object, e As System.EventArgs)
    Dim middlePage = Me.ReportViewer1.TotalPages / 2
    Me.ReportViewer1.CurrentPage = middlePage
End Sub
// Go to the middle of the report
private void GoToMiddle(object sender, System.EventArgs e)
{
    var middlePage = this.reportViewer1.TotalPages / 2;
    this.reportViewer1.CurrentPage = middlePage;
}

ViewMode

Specifies whether the viewer is in interactive or print preview mode.

Declaration
public ViewMode ViewMode { get; set; }
Property Value
ViewMode

Examples
' Switch to interactive mode
Private Sub SwitchToInteractive(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ViewMode = Telerik.ReportViewer.Wpf.ViewMode.Interactive
End Sub
// Switch to interactive mode
private void SwitchToInteractive(object sender, System.EventArgs e)
{
    this.reportViewer1.ViewMode = Telerik.ReportViewer.Wpf.ViewMode.Interactive;
}

ZoomMode

Gets or sets the zoom mode of the control.

Declaration
public ZoomMode ZoomMode { get; set; }
Property Value
ZoomMode

Examples
' Set the zoom mode to PageWidth
Private Sub ChangeZoomMode(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ZoomMode = Telerik.ReportViewer.Wpf.ZoomMode.PageWidth
End Sub
// Set the zoom mode to PageWidth
private void ChangeZoomMode(object sender, System.EventArgs e)
{
    this.reportViewer1.ZoomMode = Telerik.ReportViewer.Wpf.ZoomMode.PageWidth;
}

ZoomPercent

Gets or sets the zoom percentage to use when displaying the report.

Declaration
public int ZoomPercent { get; set; }
Property Value
System.Int32

Examples
' Set the zoom percent to a specific value
Private Sub ChangeZoomPercent(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ZoomMode = Telerik.ReportViewer.Wpf.ZoomMode.Percent
    Me.ReportViewer1.ZoomPercent = 140
End Sub
// Set the zoom percent to a specific value
private void ChangeZoomPercent(object sender, System.EventArgs e)
{
    this.reportViewer1.ZoomMode = Telerik.ReportViewer.Wpf.ZoomMode.Percent;
    this.reportViewer1.ZoomPercent = 140;
}

Methods

CancelRendering()

Stops the background processing of the report.

Declaration
public void CancelRendering()
Examples
// Stop rendering the report.
private void CancelRendering(object sender, System.EventArgs e)
{
    this.reportViewer1.CancelRendering();
}
' Stop rendering the report.
Private Sub CancelRendering(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.CancelRendering()
End Sub

CancelRendering(Int32)

Stops background processing of the report.

Declaration
[Obsolete("CancelRendering(int timeout) method is now obsolete. Please use the Telerik.ReportViewer.Wpf.ReportViewer.CancelRendering() method instead.")]
public bool CancelRendering(int timeout)
Parameters
System.Int32 timeout

The number of milliseconds to wait for the background rendering to terminate. A value of -1 waits forever. A value of 0 returns immediately without waiting for the rendering to terminate.

Returns
System.Boolean

A Boolean value. A value of true is returned if the background rendering has terminated. A value of false is returned if background rendering has not terminated after the amount of time specified in the millisecondsTimeout parameter has elapsed, or if the millisecondsTimeout parameter was set to 0.

CanMoveToPage(Int32)

Determines whether the viewer can be navigated to a specified page.

Declaration
public bool CanMoveToPage(int pageIndex)
Parameters
System.Int32 pageIndex

The page number to determine navigation possibility.

Returns
System.Boolean

Returns true if the viewer can be moved to the specified page.

Examples
// Navigate to a desired page
private void NavigateToPage(object sender, System.EventArgs e)
{
    var desiredPage = 5;

    // Check if the viewer can navigate to the page since the report may have fewer pages for example
    if (this.reportViewer1.CanMoveToPage(desiredPage))
    {
        // By setting the property the viewer will automatically navigate to the page in question
        this.reportViewer1.CurrentPage = desiredPage;
    }
}
' Navigate to a desired page
Private Sub NavigateToPage(sender As Object, e As System.EventArgs)
    Dim desiredPage = 5

    ' Check if the viewer can navigate to the page since the report may have fewer pages for example
    If Me.ReportViewer1.CanMoveToPage(desiredPage) Then
        ' By setting the property the viewer will automatically navigate to the page in question
        Me.ReportViewer1.CurrentPage = desiredPage
    End If
End Sub

ClearHistory()

Clears the report viewer navigation history.

Declaration
public void ClearHistory()

DisposeModel()

Disposes the model and detaches its event handlers.

Declaration
public virtual void DisposeModel()

DisposeViewerResources()

Detaches the event handlers from the owner window. Disposes the model and detaches its event handlers.

Declaration
public virtual void DisposeViewerResources()

DisposeViewerResources(Object)

Detaches the event handlers from the owner window. Disposes the model and detaches its event handlers.

Declaration
public virtual void DisposeViewerResources(object ownerWindow)
Parameters
System.Object ownerWindow

The owner window of the ReportViewer instance.

ExportReport(String, Hashtable)

Exports the report in the specified format.

Declaration
public void ExportReport(string format, Hashtable deviceInfo)
Parameters
System.String format

Export format

System.Collections.Hashtable deviceInfo

Contains parameters to pass to the rendering extension.

Examples
// Opens the dialog to export the report
private void ExportReport(object sender, System.EventArgs e)
{
    this.reportViewer1.ExportReport("PDF", null);
}
' Opens the dialog to export the report
Private Sub ExportReport(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ExportReport("PDF", Nothing)
End Sub

InitializeModel()

Instantiates and initializes the report viewer model.

Declaration
public void InitializeModel()

NavigateBack()

Navigates the viewer back one step in the navigation history.

Declaration
public void NavigateBack()
Remarks

Check NavigateBackEnabled if this operation is enabled. If not, exception is thrown.
The ReportSource property will reflect the change in the currently shown report.

Examples
// Navigate to the previous report in the history if available
private void NavigateBack(object sender, System.EventArgs e)
{
    if (this.reportViewer1.NavigateBackEnabled)
    {
        this.reportViewer1.NavigateBack();
    }
}
' Navigate to the previous report in the history if available
Private Sub NavigateBack(sender As Object, e As System.EventArgs)
    If Me.ReportViewer1.NavigateBackEnabled Then
        Me.ReportViewer1.NavigateBack()
    End If
End Sub

NavigateForward()

Navigates the viewer forward one step in the navigation history.

Declaration
public void NavigateForward()
Remarks

Check NavigateForwardEnabled if this operation is enabled. If not, exception is thrown.
The ReportSource property will reflect the change in the currently shown report.

Examples
// Navigate to the next report in the history if available
private void NavigateForward(object sender, System.EventArgs e)
{
    if (this.reportViewer1.NavigateForwardEnabled)
    {
        this.reportViewer1.NavigateForward();
    }
}
' Navigate to the next report in the history if available
Private Sub NavigateForward(sender As Object, e As System.EventArgs)
    If Me.ReportViewer1.NavigateBackEnabled Then
        Me.ReportViewer1.NavigateBack()
    End If
End Sub

OnApplyTemplate()

Declaration
public override void OnApplyTemplate()

OnError(ErrorEventArgs)

Raises the Error event.

Declaration
protected virtual void OnError(ErrorEventArgs e)
Parameters
ErrorEventArgs e

An ErrorEventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnExportBegin(ExportBeginEventArgs)

Raises the ExportBegin event.

Declaration
protected virtual void OnExportBegin(ExportBeginEventArgs e)
Parameters
ExportBeginEventArgs e

An ExportBeginEventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnExportEnd(ExportEndEventArgs)

Raises the ExportEnd event.

Declaration
protected virtual void OnExportEnd(ExportEndEventArgs e)
Parameters
ExportEndEventArgs e

An ExportEndEventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnInteractiveActionEnter(InteractiveActionEventArgs)

Raises the InteractiveActionEnter event.

Declaration
protected virtual void OnInteractiveActionEnter(InteractiveActionEventArgs e)
Parameters
InteractiveActionEventArgs e

A InteractiveActionEventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnInteractiveActionExecuting(InteractiveActionCancelEventArgs)

Raises the InteractiveActionExecuting event.

Declaration
protected virtual void OnInteractiveActionExecuting(InteractiveActionCancelEventArgs e)
Parameters
InteractiveActionCancelEventArgs e

A InteractiveActionCancelEventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnInteractiveActionLeave(InteractiveActionEventArgs)

Raises the InteractiveActionLeave event.

Declaration
protected virtual void OnInteractiveActionLeave(InteractiveActionEventArgs e)
Parameters
InteractiveActionEventArgs e

A InteractiveActionEventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnPrintBegin(CancelEventArgs)

Raises the PrintBegin event.

Declaration
[Obsolete("This overload is now obsolete. Please use Telerik.ReportViewer.Wpf.ReportViewer.OnPrintBegin(PrintBeginEventArgs) instead.")]
protected virtual void OnPrintBegin(CancelEventArgs e)
Parameters
System.ComponentModel.CancelEventArgs e

An System.ComponentModel.CancelEventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnPrintBegin(PrintBeginEventArgs)

Raises the PrintBegin event.

Declaration
protected virtual void OnPrintBegin(PrintBeginEventArgs e)
Parameters
PrintBeginEventArgs e

An System.ComponentModel.CancelEventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnPrintEnd(EventArgs)

Raises the PrintEnd event.

Declaration
[Obsolete("This overload is now obsolete. Please use Telerik.ReportViewer.Wpf.ReportViewer.OnPrintEnd(PrintEndEventArgs) instead.")]
protected virtual void OnPrintEnd(EventArgs e)
Parameters
System.EventArgs e

An System.EventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnPrintEnd(PrintEndEventArgs)

Raises the PrintEnd event.

Declaration
protected virtual void OnPrintEnd(PrintEndEventArgs e)
Parameters
PrintEndEventArgs e

An System.EventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnPropertyChanged(DependencyPropertyChangedEventArgs)

Declaration
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
Parameters
System.Windows.DependencyPropertyChangedEventArgs e

OnRenderingBegin(CancelEventArgs)

Raises the RenderingBegin event.

Declaration
[Obsolete("This overload is now obsolete. Please use Telerik.ReportViewer.Wpf.ReportViewer.OnRenderingBegin(RenderingBeginEventArgs) instead.")]
protected virtual void OnRenderingBegin(CancelEventArgs e)
Parameters
System.ComponentModel.CancelEventArgs e

An System.ComponentModel.CancelEventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnRenderingBegin(RenderingBeginEventArgs)

Raises the RenderingBegin event.

Declaration
protected virtual void OnRenderingBegin(RenderingBeginEventArgs e)
Parameters
RenderingBeginEventArgs e

An System.ComponentModel.CancelEventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnRenderingEnd(EventArgs)

Raises the RenderingEnd event.

Declaration
[Obsolete("This overload is now obsolete. Please use Telerik.ReportViewer.Wpf.ReportViewer.OnRenderingEnd(RenderingEndEventArgs) instead.")]
protected virtual void OnRenderingEnd(EventArgs e)
Parameters
System.EventArgs e

An System.EventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnRenderingEnd(RenderingEndEventArgs)

Raises the RenderingEnd event.

Declaration
protected virtual void OnRenderingEnd(RenderingEndEventArgs e)
Parameters
RenderingEndEventArgs e

An System.EventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

OnToolTipOpening(ToolTipOpeningEventArgs)

Occurs when the tooltip, associated with a report item, is being shown

Declaration
protected virtual void OnToolTipOpening(ToolTipOpeningEventArgs e)
Parameters
ToolTipOpeningEventArgs e

OnUpdateUI(EventArgs)

Raises the UpdateUI event.

Declaration
protected virtual void OnUpdateUI(EventArgs e)
Parameters
System.EventArgs e

An System.EventArgs object that contains the event data.

Remarks

When overridden, make sure you call the base method implementation.

PrintReport()

Opens the print dialog for the report

Declaration
public void PrintReport()
Examples
// Opens the dialog to print the report
private void PrintReport(object sender, System.EventArgs e)
{
    this.reportViewer1.PrintReport();
}
' Opens the dialog to print the report
Private Sub PrintReport(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.PrintReport()
End Sub

RefreshData()

Refreshes the current report in the viewer. Last used parameter values are used.

Declaration
[Obsolete("RefreshData method is now obsolete. Please use RefreshReport instead.")]
public void RefreshData()

RefreshReport()

Refreshes the current report in the viewer. Last used parameter values are used.

Declaration
public void RefreshReport()
Examples
// Refresh the report with the current parameters
private void RefreshReport(object sender, System.EventArgs e)
{
    this.reportViewer1.RefreshReport();
}
' Refresh the report with the current parameters
Private Sub RefreshReport(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.RefreshReport()
End Sub

ShowPageSetupDialog()

Opens the page setup dialog for the report

Declaration
public void ShowPageSetupDialog()
Examples
// Opens the page setup dialog for the report
private void ShowPageSetup(object sender, System.EventArgs e)
{
    this.reportViewer1.ShowPageSetupDialog();
}
' Opens the dialog to print the report
Private Sub ShowPageSetup(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ShowPageSetupDialog()
End Sub

ToggleReportContentSearch()

Toggles the search dialog to search within the document. If the search metadata is not prepared, invokes report refresh to generate the search metadata and then opens the dialog.

Declaration
public void ToggleReportContentSearch()

Events

Error

Occurs when there is an error in the report viewer control.

Declaration
public event ErrorEventHandler Error
Event Type
ErrorEventHandler

Examples

This example illustrates how to wire the Error event and use the event arguments to check the exception.

void reportViewer1_Error(object sender, Telerik.Reporting.ErrorEventArgs args)
{
    if (args.Exception is System.Exception) // check for a specific exception
    {
        var message = args.Exception.Message;
        // do something with the message and/or the
    }
}
Private Sub reportViewer1_Error(sender As Object, args As Telerik.Reporting.ErrorEventArgs)
    If TypeOf args.Exception Is System.Exception Then
        ' check for a specific exception
        ' do something with the message and/or the
        Dim message = args.Exception.Message
    End If
End Sub

ExportBegin

Occurs when the report in the viewer control starts exporting.

Declaration
public event ExportBeginEventHandler ExportBegin
Event Type
ExportBeginEventHandler

Examples

This example illustrates how to wire the ExportBegin event, cancel it if needed and perform some logic based on the export format.

void reportViewer1_ExportBegin(object sender, Telerik.ReportViewer.Common.ExportBeginEventArgs args)
{
    if (true) // some logic here
    {
        // Cancel is false by default
        args.Cancel = true;
    }

    switch (args.Format)
    {
        case "Excel":
            // do something
            break;
        case "PDF":
            // do something
            break;
    }
}
Private Sub reportViewer1_ExportBegin(sender As Object, args As Telerik.ReportViewer.Common.ExportBeginEventArgs)
    If True Then
        ' some logic here
        ' Cancel is false by default
        args.Cancel = True
    End If

    Select Case args.Format
        Case "Excel"
            ' do something
            Exit Select
        Case "PDF"
            ' do something
            Exit Select
    End Select
End Sub

ExportEnd

Occurs when the report exporting in the viewer control is finished.

Declaration
public event ExportEndEventHandler ExportEnd
Event Type
ExportEndEventHandler

Examples

This example illustrates how to wire the ExportEnd event.

void reportViewer1_ExportEnd(object sender, Telerik.ReportViewer.Common.ExportEndEventArgs args)
{
    if (null != args.Exception)
    {
        //some logic if report processing is not successful
    }
    else
    {
        //suppress the viewer SaveFileDialog and use your own
        args.Handled = true;
        var fileName = args.DocumentName;
        var extension = args.DocumentExtension;
        var filter = string.Format("{0} (*.{1})|*.{1}|All Files (*.*)|*.*",
                                    fileName,
                                    extension);

        var saveFileDlg = new Microsoft.Win32.SaveFileDialog
        {
            Filter = filter,
            FileName = fileName + "." + extension,
        };

        if (saveFileDlg.ShowDialog() == true)
        {
            try
            {
                using (var fs = new FileStream(saveFileDlg.FileName, FileMode.Create))
                {
                    fs.Write(args.DocumentBytes, 0, args.DocumentBytes.Length);
                }

                //Optionally open the file
                if (!string.IsNullOrEmpty(saveFileDlg.FileName))
                {
                    System.Diagnostics.Process.Start(saveFileDlg.FileName);
                }
            }
            catch (Exception)
            {
                //Handle exception
            }
        }
    }
}
Private Sub reportViewer1_ExportEnd(sender As Object, args As Telerik.ReportViewer.Common.ExportEndEventArgs)
    'some logic if report processing is not successful
    If args.Exception IsNot Nothing Then
    Else
        'suppress the viewer SaveFileDialog and use your own
        args.Handled = True
        Dim fileName = args.DocumentName
        Dim extension = args.DocumentExtension
        Dim filter = String.Format("{0} (*.{1})|*.{1}|All Files (*.*)|*.*", fileName, extension)

        Dim saveFileDlg = New Microsoft.Win32.SaveFileDialog() With { _
            .Filter = filter, _
            .FileName = fileName + "." + extension _
        }

        If saveFileDlg.ShowDialog() = True Then
            Try
                Using fs = New FileStream(saveFileDlg.FileName, FileMode.Create)
                    fs.Write(args.DocumentBytes, 0, args.DocumentBytes.Length)
                End Using

                'Optionally open the file
                If Not String.IsNullOrEmpty(saveFileDlg.FileName) Then
                    System.Diagnostics.Process.Start(saveFileDlg.FileName)
                End If
                'Handle exception
            Catch generatedExceptionName As Exception
            End Try
        End If
    End If
End Sub

InteractiveActionEnter

Occurs when the mouse cursor enters the area of a report item's action.

Declaration
public event InteractiveActionEnterEventHandler InteractiveActionEnter
Event Type
InteractiveActionEnterEventHandler

Examples

This example illustrates how to wire the event and use the event arguments

void reportViewer1_InteractiveActionEnter(object sender, Telerik.ReportViewer.Wpf.InteractiveActionEventArgs args)
{
    var strB = new System.Text.StringBuilder();
    strB.AppendLine("You have just entered an action area.");
    strB.AppendLine("Action type: " + args.Action.GetType().Name);
    strB.AppendLine("ReportItem name: " + args.Action.ReportItemName);
    strB.AppendLine(string.Format("Mouse cursor position: {0}; Item bounds: {1}", args.CursorPos, args.Bounds));

    Console.Out.WriteLine(strB.ToString());
}
' Handles the InteractiveActionEnter event
Private Sub reportViewer1_InteractiveActionEnter(sender As Object, args As Telerik.ReportViewer.Wpf.InteractiveActionEventArgs) Handles ReportViewer1.InteractiveActionEnter

    Dim strB = New System.Text.StringBuilder()
    strB.AppendLine("You have just entered an action area.")
    strB.AppendLine("Action type: " + args.Action.[GetType]().Name)
    strB.AppendLine("ReportItem name: " + args.Action.ReportItemName)
    strB.AppendLine(String.Format("Mouse cursor position: {0}; Item bounds: {1}", args.CursorPos, args.Bounds))

    Console.Out.WriteLine(strB.ToString())
End Sub

InteractiveActionExecuting

Occurs when an action is being executed. Execution can be canceled.

Declaration
public event InteractiveActionExecutingEventHandler InteractiveActionExecuting
Event Type
InteractiveActionExecutingEventHandler

Examples

This example illustrates how to wire the event and use the event arguments.

void reportViewer1_CustomInteractiveActionExecuting(object sender, Telerik.ReportViewer.Wpf.InteractiveActionCancelEventArgs args)
{
    var strB = new System.Text.StringBuilder();
    strB.AppendLine("ReportItem name: " + args.Action.ReportItemName);

    var customAction = args.Action as Telerik.Reporting.Processing.CustomAction;
    if (null != customAction)
    {
        foreach (var p in customAction.Parameters)
        {
            strB.AppendLine(string.Format("Parameter \"{0}\" value: {1}", p.Key, p.Value));
        }
    }

    strB.AppendLine(string.Format("Mouse cursor position: {0}; Item bounds: {1}", args.CursorPos, args.Bounds));

    MessageBox.Show(strB.ToString());
}
void reportViewer1_InteractiveActionExecuting(object sender, Telerik.ReportViewer.Wpf.InteractiveActionCancelEventArgs args)
{
    var navigateToUrlAction = args.Action as Telerik.Reporting.Processing.NavigateToUrlAction;
    if (null != navigateToUrlAction)
    {
        if (!navigateToUrlAction.Url.StartsWith("https"))
        {
            args.Cancel = MessageBox.Show("You are about to navigate to a non-secure page. Continue?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes;
        }
    }
}
' Handles the InteractiveActionExecuting event
Private Sub reportViewer1_CustomInteractiveActionExecuting(sender As Object, args As Telerik.ReportViewer.Wpf.InteractiveActionCancelEventArgs) Handles ReportViewer1.InteractiveActionExecuting

    Dim strB = New System.Text.StringBuilder()
    strB.AppendLine("ReportItem name: " + args.Action.ReportItemName)

    Dim customAction = TryCast(args.Action, Telerik.Reporting.Processing.CustomAction)
    If customAction IsNot Nothing Then
        For Each p As KeyValuePair(Of String, Object) In customAction.Parameters
            strB.AppendLine(String.Format("Parameter ""{0}"" value: {1}", p.Key, p.Value))
        Next
    End If

    strB.AppendLine(String.Format("Mouse cursor position: {0}; Item bounds: {1}", args.CursorPos, args.Bounds))

    MessageBox.Show(strB.ToString())
End Sub
' Handles the InteractiveActionExecuting event
Private Sub reportViewer1_InteractiveActionExecuting(sender As Object, args As Telerik.ReportViewer.Wpf.InteractiveActionCancelEventArgs) Handles ReportViewer1.InteractiveActionExecuting

    Dim navigateToUrlAction = TryCast(args.Action, Telerik.Reporting.Processing.NavigateToUrlAction)
    If navigateToUrlAction IsNot Nothing Then
        If Not navigateToUrlAction.Url.StartsWith("https") Then
            args.Cancel = MessageBox.Show("You are about to navigate to a non-secure page. Continue?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning) <> MessageBoxResult.Yes
        End If
    End If
End Sub

InteractiveActionLeave

Occurs when the mouse cursor leaves the area of a report item's action.

Declaration
public event InteractiveActionLeaveEventHandler InteractiveActionLeave
Event Type
InteractiveActionLeaveEventHandler

Examples

This example illustrates how to wire the event and use the event arguments

void reportViewer1_InteractiveActionLeave(object sender, Telerik.ReportViewer.Wpf.InteractiveActionEventArgs args)
{
    var strB = new System.Text.StringBuilder();
    strB.AppendLine("You have just left an action area.");
    strB.AppendLine("Action type: " + args.Action.GetType().Name);
    strB.AppendLine("ReportItem name: " + args.Action.ReportItemName);
    strB.AppendLine(string.Format("Item bounds: {0}", args.Bounds));

    Console.Out.WriteLine(strB.ToString());
}
' Handles the InteractiveActionLeave event
Private Sub reportViewer1_InteractiveActionLeave(sender As Object, args As Telerik.ReportViewer.Wpf.InteractiveActionEventArgs) Handles ReportViewer1.InteractiveActionLeave

    Dim strB = New System.Text.StringBuilder()
    strB.AppendLine("You have just left an action area.")
    strB.AppendLine("Action type: " + args.Action.[GetType]().Name)
    strB.AppendLine("ReportItem name: " + args.Action.ReportItemName)
    strB.AppendLine(String.Format("Item bounds: {0}", args.Bounds))

    Console.Out.WriteLine(strB.ToString())
End Sub

PrintBegin

Occurs when the report in the viewer control starts printing.

Declaration
public event PrintBeginEventHandler PrintBegin
Event Type
PrintBeginEventHandler

Examples

This example illustrates how to wire the PrintBegin event and how to cancel it if needed.

void reportViewer1_PrintBegin(object sender, Telerik.ReportViewer.Common.PrintBeginEventArgs e)
{
    if (true) // some logic here
    {
        // Cancel is false by default
        e.Cancel = true;
    }

    //To prevent the Print Dialog from appearing, you should specify valid printer settings to this method.
    if (true)
    {
        // Obtain the settings of the default printer
        e.PrinterSettings = new System.Drawing.Printing.PrinterSettings();

        // To suppress the Print dialogs. The standard print controller comes with no UI
        e.PrintController = new System.Drawing.Printing.StandardPrintController();
    }
}
Private Sub reportViewer1_PrintBegin(sender As Object, e As Telerik.ReportViewer.Common.PrintBeginEventArgs)
    If True Then
        ' some logic here
        ' Cancel is false by default
        e.Cancel = True
    End If

    ' To prevent the Print Dialog from appearing, you should specify valid printer settings to this method.
    If True Then
        ' Obtain the settings of the default printer
        e.PrinterSettings = New System.Drawing.Printing.PrinterSettings()

        ' To suppress the Print dialogs. The standard print controller comes with no UI
        e.PrintController = New System.Drawing.Printing.StandardPrintController()
    End If
End Sub

PrintEnd

Occurs when the report printing in the viewer control is finished.

Declaration
public event PrintEndEventHandler PrintEnd
Event Type
PrintEndEventHandler

Examples

This example illustrates how to wire the PrintEnd event.

void reportViewer1_PrintEnd(object sender, Telerik.ReportViewer.Common.PrintEndEventArgs e)
{
    // suitable for logging and triggering other actions
}
Private Sub reportViewer1_PrintEnd(sender As Object, e As Telerik.ReportViewer.Common.PrintEndEventArgs)
    ' suitable for logging and triggering other actions
End Sub

RenderingBegin

Occurs when the report in the viewer control starts rendering.

Declaration
public event RenderingBeginEventHandler RenderingBegin
Event Type
RenderingBeginEventHandler

Examples

This example illustrates how to wire the RenderingBegin event and how to cancel it if needed.

void reportViewer1_RenderingBegin(object sender, Telerik.ReportViewer.Common.RenderingBeginEventArgs e)
{
    if (true) // some logic here
    {
        // Cancel is false by default
        e.Cancel = true;
    }
}
Private Sub reportViewer1_RenderingBegin(sender As Object, e As Telerik.ReportViewer.Common.RenderingBeginEventArgs)
    If True Then
        ' some logic here
        ' Cancel is false by default
        e.Cancel = True
    End If
End Sub

RenderingEnd

Occurs when the report rendering in the viewer control is finished.

Declaration
public event RenderingEndEventHandler RenderingEnd
Event Type
RenderingEndEventHandler

Examples

This example illustrates how to wire the RenderingEnd event.

void reportViewer1_RenderingEnd(object sender, Telerik.ReportViewer.Common.RenderingEndEventArgs e)
{
    // suitable for logging and triggering other actions
}
Private Sub reportViewer1_RenderingEnd(sender As Object, e As Telerik.ReportViewer.Common.RenderingEndEventArgs)
    ' suitable for logging and triggering other actions
End Sub

UpdateUI

Occurs when the UI of the report viewer control is updated.

Declaration
public event EventHandler UpdateUI
Event Type
System.EventHandler

Examples

This example illustrates how to wire the UpdateUI event.

void reportViewer1_UpdateUI(object sender, System.EventArgs e)
{
    // invoked whenever the viewer state is changed
}
Private Sub reportViewer1_UpdateUI(sender As Object, e As System.EventArgs)
    ' invoked whenever the viewer state is changed
End Sub

ViewerToolTipOpening

Occurs when the tooltip, associated with a report item, is being opened

Declaration
public event ToolTipOpeningEventHandler ViewerToolTipOpening
Event Type
ToolTipOpeningEventHandler

Examples

This example illustrates how to wire the event, cancel tooltip showing and change tooltip's title and text.

private void reportViewer1_ViewerToolTipOpening(object sender, Telerik.ReportViewer.Wpf.ToolTipOpeningEventArgs args)
{
    if (args.ToolTip.Title.Contains("DoNotShow"))
    {
        args.Cancel = true;
    }
    else
    {
        args.ToolTip.Title = "The tooltip title is changed!";
        args.ToolTip.Text += " (changed)";
    }
}
' Handles the InteractiveActionLeave event
Private Sub reportViewer1_ViewerToolTipOpening(sender As Object, args As Telerik.ReportViewer.Wpf.ToolTipOpeningEventArgs) Handles ReportViewer1.ViewerToolTipOpening
    If args.ToolTip.Title.Contains("DoNotShow") Then
        args.Cancel = True
    Else
        args.ToolTip.Title = "The tooltip title is changed!"
        args.ToolTip.Text += " (changed)"
    End If
End Sub
Getting Started
  • Install Now
  • Online Demos
Support Resources
  • Documentation
  • Knowledge Base
  • Videos
  • Reporting Samples Repository
  • Reporting Release History
Community
  • Forums
  • Blogs
  • Reporting Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://docs.telerik.com/reporting/api/Telerik.ReportViewer.WPF.ReportViewer

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy