MindFusion.Reporting for Silverlight Programmer's Guide
Report.Prerender Event
See Also
 





Raised for each item in the report just before the item is added to the visual tree during rendering.

Namespace: MindFusion.Reporting.Silverlight
Assembly: MindFusion.Reporting.Silverlight

 Syntax

C#  Copy Code

public event EventHandler<PrerenderEventArgs> Prerender

Visual Basic  Copy Code

Public Event Prerender As EventHandler(Of PrerenderEventArgs)

 Remarks

This event can be used to prevent the rendering of specific items or to modify their visual representation based on custom criteria. The event is raised after the visual representation of an item is created but before it is added to the visual tree of the final report.

The event argument supplies a reference to the ReportItem being rendered and a reference to the root UIElement of the item's visual tree. The visual tree of the item can be modified or completely replaced through this event.

 Example

The following code illustrates how to use this event in order to change the background of an ItemContainer object. The ItemContainer objects are used as a container for all items in a single row entry within a DataRange.

C#  Copy Code

private void myReport_Prerender(object sender, PrerenderEventArgs e)
{
    if (e.Item is ItemContainer)
    {
        if (someCondition)
        {
            var border = e.RootVisual as Border;
            border.Background = new SolidColorBrush(Colors.Red);
        }
    }
}

Visual Basic  Copy Code

Private Sub myReport_Prerender(ByVal sender As Object, ByVal e As PrerenderEventArgs)

    If (TypeOf e.Item Is ItemContainer) Then

        If (someCondition) Then

            Dim border = CType(e.RootVisual, Border)
            border.Background = New SolidColorBrush(Colors.Red)

        End If

    End If

End Sub

 See Also

Report Members
Report Class
MindFusion.Reporting.Silverlight Namespace
PrerenderEventArgs Class