Class
ReportViewer

Represents the WPF ReportViewer control.

Definition

Namespace:Telerik.ReportViewer.Wpf

Assembly:Telerik.ReportViewer.Wpf.dll

Syntax:

cs-api-definition
[TemplatePart(Name = "PageScrollViewer", Type = typeof(ScrollViewer))]
[TemplatePart(Name = "PageContainer", Type = typeof(ContentControl))]
[TemplatePart(Name = "LayoutRoot", Type = typeof(FrameworkElement))]
public class ReportViewer : Control

Inheritance: objectDispatcherObjectDependencyObjectVisualUIElementFrameworkElementControlReportViewer

Constructors

ReportViewer()

Initializes a new instance of the ReportViewer class.

Declaration

cs-api-definition
public ReportViewer()

Fields

AllowNavigatingToFileUrlsProperty

Defines the AllowNavigatingToFileUrls property

Declaration

cs-api-definition
public static readonly DependencyProperty AllowNavigatingToFileUrlsProperty

Field Value

DependencyProperty

AutoDisposeModelProperty

Defines the AutoDisposeModel property

Declaration

cs-api-definition
public static readonly DependencyProperty AutoDisposeModelProperty

Field Value

DependencyProperty

CornerRadiusProperty

DependencyProperty for CornerRadius property.

Declaration

cs-api-definition
public static readonly DependencyProperty CornerRadiusProperty

Field Value

DependencyProperty

EnableAccessibilityProperty

Defines the EnableAccessibility property

Declaration

cs-api-definition
public static readonly DependencyProperty EnableAccessibilityProperty

Field Value

DependencyProperty

ReportEngineConnectionProperty

Defines the ReportEngineConnection property

Declaration

cs-api-definition
public static readonly DependencyProperty ReportEngineConnectionProperty

Field Value

DependencyProperty

ReportSourceProperty

Defines the ReportSource dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty ReportSourceProperty

Field Value

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

cs-api-definition
public static readonly DependencyProperty SearchMetadataOnDemandProperty

Field Value

DependencyProperty

TextResourcesProperty

Defines the TextResources property.

Declaration

cs-api-definition
public static readonly DependencyProperty TextResourcesProperty

Field Value

DependencyProperty

ViewModeProperty

Defines the ViewMode property.

Declaration

cs-api-definition
public static readonly DependencyProperty ViewModeProperty

Field Value

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

cs-api-definition
public static readonly DependencyProperty ZoomModeProperty

Field Value

DependencyProperty

ZoomPercentProperty

Defines the ZoomPercent property.

Declaration

cs-api-definition
public static readonly DependencyProperty ZoomPercentProperty

Field Value

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

cs-api-definition
[Browsable(false)]
public Dictionary<int, ShortcutKeys> AccessibilityKeyMap { get; set; }

Property Value

Dictionary<int, ShortcutKeys>

AllowNavigatingToFileUrls

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

Declaration

cs-api-definition
public bool AllowNavigatingToFileUrls { get; set; }

Property Value

bool

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

cs-api-definition
public bool AutoDisposeModel { get; set; }

Property Value

bool

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

cs-api-definition
public CornerRadius CornerRadius { get; set; }

Property Value

CornerRadius

CurrentPage

Gets or sets the current page in the viewer.

Declaration

cs-api-definition
public int CurrentPage { get; set; }

Property Value

int

Example

cs
// 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;
    }
}
vb
' 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

cs-api-definition
public bool DocumentMapVisible { get; set; }

Property Value

bool

Example

vb
' Toggle the document map
Private Sub ToggleDocumentMapVisibility(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.DocumentMapVisible = Not Me.ReportViewer1.DocumentMapVisible
End Sub 
cs
// 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

cs-api-definition
public bool EnableAccessibility { get; set; }

Property Value

bool

NavigateBackEnabled

Determines if navigate back in report viewer history operation is enabled

Declaration

cs-api-definition
public bool NavigateBackEnabled { get; }

Property Value

bool

Example

vb
' 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 
cs
// 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

cs-api-definition
public bool NavigateForwardEnabled { get; }

Property Value

bool

Example

vb
' 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 
cs
// 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

cs-api-definition
public bool ParametersAreaVisible { get; set; }

Property Value

bool

Example

vb
' Toggle the parameters area
Private Sub ToggleParametersAreaVisibility(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ParametersAreaVisible = Not Me.ReportViewer1.ParametersAreaVisible
End Sub 
cs
// 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

cs-api-definition
[Browsable(false)]
public IEnumerable<RenderingExtension> RenderingExtensions { get; }

Property Value

IEnumerable<RenderingExtension>

ReportEngineConnection

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

Declaration

cs-api-definition
public string ReportEngineConnection { get; set; }

Property Value

string

Remarks

If the selected engine is of remote type (REST Service or Report Server), the following extra dependencies are required:

  • Telerik.Reporting.Services.HttpClient
  • System.Net.Http
  • System.Net.Http.Formatting

Note: Connecting to Report Server for .NET is not supported yet.

Example

cs
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. 
}
vb
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 
cs
private void SetReportServerReportEngineConnection(object sender, System.EventArgs e)
{
    this.reportViewer1.ReportEngineConnection = new Telerik.ReportViewer.Common.ReportServerConnectionInfo("http://reportserver:83", "user", "pass").ConnectionString;
}
vb
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 
cs
private void SetRestServiceReportEngineConnection(object sender, System.EventArgs e)
{
    this.reportViewer1.ReportEngineConnection = new Telerik.ReportViewer.Common.RestServiceConnectionInfo("http://servicehost:83/api/reports", "authToken").ConnectionString;
}
vb
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 

ReportSource

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

Declaration

cs-api-definition
public ReportSource ReportSource { get; set; }

Property Value

ReportSource

ReportViewerModel

Gets the ReportViewerModel instance.

Declaration

cs-api-definition
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

cs-api-definition
public bool SearchMetadataOnDemand { get; set; }

Property Value

bool

TextResources

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

Declaration

cs-api-definition
[TypeConverter(typeof(ExpandableObjectConverter))]
public ITextResources TextResources { get; set; }

Property Value

ITextResources

TotalPages

Gets the count of the available pages in the viewer.

Declaration

cs-api-definition
[Browsable(false)]
public int TotalPages { get; }

Property Value

int

Example

vb
' 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 
cs
// 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

cs-api-definition
public ViewMode ViewMode { get; set; }

Property Value

ViewMode

Example

vb
' Switch to interactive mode
Private Sub SwitchToInteractive(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ViewMode = Telerik.ReportViewer.Wpf.ViewMode.Interactive
End Sub 
cs
// 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

cs-api-definition
[TypeConverter(typeof(ZoomModeConverter))]
public ZoomMode ZoomMode { get; set; }

Property Value

ZoomMode

Example

vb
' 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 
cs
// 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

cs-api-definition
public int ZoomPercent { get; set; }

Property Value

int

Example

vb
' 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 
cs
// 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

CanMoveToPage(int)

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

Declaration

cs-api-definition
public bool CanMoveToPage(int pageIndex)

Parameters

pageIndex

int

The page number to determine navigation possibility.

Returns

bool

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

Example

cs
// 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;
    }
}
vb
' 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 

CancelRendering()

Stops the background processing of the report.

Declaration

cs-api-definition
public void CancelRendering()

Example

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

CancelRendering(int)

Stops background processing of the report.

Declaration

cs-api-definition
[Obsolete("CancelRendering(int timeout) method is now obsolete. Please use the Telerik.ReportViewer.Wpf.ReportViewer.CancelRendering() method instead.")]
public bool CancelRendering(int timeout)

Parameters

timeout

int

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

bool

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.

ClearHistory()

Clears the report viewer navigation history.

Declaration

cs-api-definition
public void ClearHistory()

DisplayLicenseUI(LicenseInfo, string)

Displays the license information UI.

Declaration

cs-api-definition
public void DisplayLicenseUI(LicenseInfo licenseInfo, string productVersion)

Parameters

licenseInfo

LicenseInfo

productVersion

string

DisposeModel()

Disposes the model and detaches its event handlers.

Declaration

cs-api-definition
public virtual void DisposeModel()

DisposeViewerResources()

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

Declaration

cs-api-definition
public virtual void DisposeViewerResources()

DisposeViewerResources(object)

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

Declaration

cs-api-definition
public virtual void DisposeViewerResources(object ownerWindow)

Parameters

ownerWindow

object

The owner window of the ReportViewer instance.

ExportReport(string, Hashtable)

Exports the report in the specified format.

Declaration

cs-api-definition
public void ExportReport(string format, Hashtable deviceInfo)

Parameters

format

string

Export format

deviceInfo

Hashtable

Contains parameters to pass to the rendering extension.

Example

cs
// Opens the dialog to export the report
private void ExportReport(object sender, System.EventArgs e)
{
    this.reportViewer1.ExportReport("PDF", null);
}
vb
' 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

cs-api-definition
public void InitializeModel()

NavigateBack()

Navigates the viewer back one step in the navigation history.

Declaration

cs-api-definition
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.

Example

cs
// 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();
    }
}
vb
' 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

cs-api-definition
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.

Example

cs
// 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();
    }
}
vb
' 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

cs-api-definition
public override void OnApplyTemplate()

Overrides FrameworkElement.OnApplyTemplate()

OnError(ErrorEventArgs)

Raises the Error event.

Declaration

cs-api-definition
protected virtual void OnError(ErrorEventArgs e)

Parameters

e

ErrorEventArgs

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

cs-api-definition
protected virtual void OnExportBegin(ExportBeginEventArgs e)

Parameters

e

ExportBeginEventArgs

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

cs-api-definition
protected virtual void OnExportEnd(ExportEndEventArgs e)

Parameters

e

ExportEndEventArgs

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

cs-api-definition
protected virtual void OnInteractiveActionEnter(InteractiveActionEventArgs e)

Parameters

e

InteractiveActionEventArgs

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

cs-api-definition
protected virtual void OnInteractiveActionExecuting(InteractiveActionCancelEventArgs e)

Parameters

e

InteractiveActionCancelEventArgs

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

cs-api-definition
protected virtual void OnInteractiveActionLeave(InteractiveActionEventArgs e)

Parameters

e

InteractiveActionEventArgs

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

cs-api-definition
[Obsolete("This overload is now obsolete. Please use Telerik.ReportViewer.Wpf.ReportViewer.OnPrintBegin(PrintBeginEventArgs) instead.")]
protected virtual void OnPrintBegin(CancelEventArgs e)

Parameters

e

CancelEventArgs

An 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

cs-api-definition
protected virtual void OnPrintBegin(PrintBeginEventArgs e)

Parameters

e

PrintBeginEventArgs

An 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

cs-api-definition
[Obsolete("This overload is now obsolete. Please use Telerik.ReportViewer.Wpf.ReportViewer.OnPrintEnd(PrintEndEventArgs) instead.")]
protected virtual void OnPrintEnd(EventArgs e)

Parameters

e

EventArgs

An 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

cs-api-definition
protected virtual void OnPrintEnd(PrintEndEventArgs e)

Parameters

e

PrintEndEventArgs

An EventArgs object that contains the event data.

Remarks

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

OnPropertyChanged(DependencyPropertyChangedEventArgs)

Declaration

cs-api-definition
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)

Parameters

e

DependencyPropertyChangedEventArgs

Overrides FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs)

OnRenderingBegin(CancelEventArgs)

Raises the RenderingBegin event.

Declaration

cs-api-definition
[Obsolete("This overload is now obsolete. Please use Telerik.ReportViewer.Wpf.ReportViewer.OnRenderingBegin(RenderingBeginEventArgs) instead.")]
protected virtual void OnRenderingBegin(CancelEventArgs e)

Parameters

e

CancelEventArgs

An 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

cs-api-definition
protected virtual void OnRenderingBegin(RenderingBeginEventArgs e)

Parameters

e

RenderingBeginEventArgs

An 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

cs-api-definition
[Obsolete("This overload is now obsolete. Please use Telerik.ReportViewer.Wpf.ReportViewer.OnRenderingEnd(RenderingEndEventArgs) instead.")]
protected virtual void OnRenderingEnd(EventArgs e)

Parameters

e

EventArgs

An 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

cs-api-definition
protected virtual void OnRenderingEnd(RenderingEndEventArgs e)

Parameters

e

RenderingEndEventArgs

An 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

cs-api-definition
protected virtual void OnToolTipOpening(ToolTipOpeningEventArgs e)

Parameters

e

ToolTipOpeningEventArgs

OnUpdateUI(EventArgs)

Raises the UpdateUI event.

Declaration

cs-api-definition
protected virtual void OnUpdateUI(EventArgs e)

Parameters

e

EventArgs

An 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

cs-api-definition
public void PrintReport()

Example

cs
// Opens the dialog to print the report
private void PrintReport(object sender, System.EventArgs e)
{
    this.reportViewer1.PrintReport();
}
vb
' 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

cs-api-definition
[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

cs-api-definition
public void RefreshReport()

Example

cs
// Refresh the report with the current parameters
private void RefreshReport(object sender, System.EventArgs e)
{
    this.reportViewer1.RefreshReport();
}
vb
' 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

cs-api-definition
public void ShowPageSetupDialog()

Example

cs
// Opens the page setup dialog for the report
private void ShowPageSetup(object sender, System.EventArgs e)
{
    this.reportViewer1.ShowPageSetupDialog();
}
vb
' 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

cs-api-definition
public void ToggleReportContentSearch()

Events

Error

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

Declaration

cs-api-definition
public event ErrorEventHandler Error

Event Value

ErrorEventHandler

Example

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

cs
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 
    }
}
vb
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

cs-api-definition
public event ExportBeginEventHandler ExportBegin

Event Value

ExportBeginEventHandler

Remarks

Can be used to modify device info settings, such as report culture, before the export starts

Example

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

cs
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;
    }
}
vb
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

cs-api-definition
public event ExportEndEventHandler ExportEnd

Event Value

ExportEndEventHandler

Example

This example illustrates how to wire the ExportEnd event.

cs
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
            }
        }
    }
}
vb
 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

cs-api-definition
public event InteractiveActionEnterEventHandler InteractiveActionEnter

Event Value

InteractiveActionEnterEventHandler

Example

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

cs
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());
}
vb
' 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

cs-api-definition
public event InteractiveActionExecutingEventHandler InteractiveActionExecuting

Event Value

InteractiveActionExecutingEventHandler

Example

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

cs
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());
}
cs
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;
        }
    }
}
vb
' 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 
vb
' 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 

InteractiveActionLeave

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

Declaration

cs-api-definition
public event InteractiveActionLeaveEventHandler InteractiveActionLeave

Event Value

InteractiveActionLeaveEventHandler

Example

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

cs
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());
}
vb
' 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

cs-api-definition
public event PrintBeginEventHandler PrintBegin

Event Value

PrintBeginEventHandler

Example

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

cs
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();
    }
}
vb
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

cs-api-definition
public event PrintEndEventHandler PrintEnd

Event Value

PrintEndEventHandler

Example

This example illustrates how to wire the PrintEnd event.

cs
void reportViewer1_PrintEnd(object sender, Telerik.ReportViewer.Common.PrintEndEventArgs e)
{
    // suitable for logging and triggering other actions
}
vb
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

cs-api-definition
public event RenderingBeginEventHandler RenderingBegin

Event Value

RenderingBeginEventHandler

Remarks

Can be used to modify device info settings, such as report culture, before the rendering starts

Example

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

cs
void reportViewer1_RenderingBegin(object sender, Telerik.ReportViewer.Common.RenderingBeginEventArgs e)
{
    if (true) // some logic here
    {
        // Cancel is false by default
        e.Cancel = true;
    }
}
vb
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

cs-api-definition
public event RenderingEndEventHandler RenderingEnd

Event Value

RenderingEndEventHandler

Example

This example illustrates how to wire the RenderingEnd event.

cs
void reportViewer1_RenderingEnd(object sender, Telerik.ReportViewer.Common.RenderingEndEventArgs e)
{
    // suitable for logging and triggering other actions
}
vb
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

cs-api-definition
public event EventHandler UpdateUI

Event Value

EventHandler

Example

This example illustrates how to wire the UpdateUI event.

cs
void reportViewer1_UpdateUI(object sender, System.EventArgs e)
{
    // invoked whenever the viewer state is changed
}
vb
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

cs-api-definition
public event ToolTipOpeningEventHandler ViewerToolTipOpening

Event Value

ToolTipOpeningEventHandler

Example

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

cs
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)";
    }
}
vb
' 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 
In this article
DefinitionConstructorsReportViewer()FieldsAllowNavigatingToFileUrlsPropertyAutoDisposeModelPropertyCornerRadiusPropertyEnableAccessibilityPropertyReportEngineConnectionPropertyReportSourcePropertySearchMetadataOnDemandPropertyTextResourcesPropertyViewModePropertyZoomModePropertyZoomPercentPropertyPropertiesAccessibilityKeyMapAllowNavigatingToFileUrlsAutoDisposeModelCornerRadiusCurrentPageDocumentMapVisibleEnableAccessibilityNavigateBackEnabledNavigateForwardEnabledParametersAreaVisibleRenderingExtensionsReportEngineConnectionReportSourceReportViewerModelSearchMetadataOnDemandTextResourcesTotalPagesViewModeZoomModeZoomPercentMethodsCanMoveToPage(int)CancelRendering()CancelRendering(int)ClearHistory()DisplayLicenseUI(LicenseInfo, string)DisposeModel()DisposeViewerResources()DisposeViewerResources(object)ExportReport(string, Hashtable)InitializeModel()NavigateBack()NavigateForward()OnApplyTemplate()OnError(ErrorEventArgs)OnExportBegin(ExportBeginEventArgs)OnExportEnd(ExportEndEventArgs)OnInteractiveActionEnter(InteractiveActionEventArgs)OnInteractiveActionExecuting(InteractiveActionCancelEventArgs)OnInteractiveActionLeave(InteractiveActionEventArgs)OnPrintBegin(CancelEventArgs)OnPrintBegin(PrintBeginEventArgs)OnPrintEnd(EventArgs)OnPrintEnd(PrintEndEventArgs)OnPropertyChanged(DependencyPropertyChangedEventArgs)OnRenderingBegin(CancelEventArgs)OnRenderingBegin(RenderingBeginEventArgs)OnRenderingEnd(EventArgs)OnRenderingEnd(RenderingEndEventArgs)OnToolTipOpening(ToolTipOpeningEventArgs)OnUpdateUI(EventArgs)PrintReport()RefreshData()RefreshReport()ShowPageSetupDialog()ToggleReportContentSearch()EventsErrorExportBeginExportEndInteractiveActionEnterInteractiveActionExecutingInteractiveActionLeavePrintBeginPrintEndRenderingBeginRenderingEndUpdateUIViewerToolTipOpening
Not finding the help you need?
Contact Support