MindFusion.Wpf Pack Programmer's Guide
Report.QueryStyle Event
See Also
 





Raised during the printing or previewing to allow clients to customize the style of elements displayed in the report.

Namespace: MindFusion.Scheduling.Reporting
Assembly: MindFusion.Scheduling.Wpf.Reporting

 Syntax

C#  Copy Code

public event EventHandler<ReportQueryStyleEventArgs> QueryStyle

Visual Basic  Copy Code

Public Event QueryStyle As EventHandler(Of ReportQueryStyleEventArgs)

 Event Data

QueryStyle event handlers receive an argument of type ReportQueryStyleEventArgs.

 Remarks

The style of the cells displayed in the report is controlled from several properties. The ContentStyle and AlternativeContentStyle properties of the associated ReportOptions object provide general styling of the contents. The ContentStyle and AlternativeContentStyle properties of the individual ReportColumn objects provide more specific styling for the cells associated with a particular column.

You can use this event to specify even more detailed styling - for individual cells that meet certain criteria. For example, you can specify different background for cells which display specific value.

 Example

The following example demonstrates how to specify red background for all items which end in the past:

C#  Copy Code
void OnQueryStyle(object sender, ReportQueryStyleEventArgs e)
{
    if (e.Item.EndTime < DateTime.Now)
    {
        ReportStyle customStyle = new ReportStyle();
        customStyle.Background = Brushes.Red;
        e.Style = customStyle;
    }
}
Visual Basic  Copy Code

Sub OnQueryStyle(ByVal sender As Object, ByVal e As ReportQueryStyleEventArgs)

    If e.Item.EndTime < DateTime.Now Then

        Dim customStyle As New ReportStyle()
        customStyle.Background = Brushes.Red
        e.Style = customStyle

    End If

End Sub

 See Also

Report Members
Report Class
MindFusion.Scheduling.Reporting Namespace