SharpShooter Reports.WPF
New Events: Click and Hover
SharpShooter Reports 6.5 introduces new important events, reacting to a click on the element and hovering a cursor over the element.
New events are defined in the following way:
public
event
EventHandler<ReportElementMouseEventArgs> ElementClick;
public
event
EventHandler<ReportElementMouseEventArgs> ElementHover;
The ElementClick event is fired by clicking the report element. In case there is no element located under the mouse cursor, the event is not fired.
The ElementHover event is fired when the mouse cursor shifts to any element of the report. If the mouse cursor has been moved to the area that doesn’t contain any element, the event will be fired with empty arguments. The event can be used either for displaying some additional information about the area or for highlighting the report area with the mouse cursor on it. For example, it’s possible to highlight the table line on which the mouse cursor is positioned so that the user can mark out the line for certain purpose or get detailed information about the marked line.
As we see, both events use the same type of arguments. ReportElementMouseEventArgs has two main string properties:
- ElementUniqueName – a string that represents the unique name of the element. Using this name makes it possible to get the link to a document element with the use of GetControlByUniqueName document method. The example given below is devoid of any particular sense, but demonstrates how the unique name can be used by event handlers.
void
reportViewer_ElementClick(
object
sender, ReportElementMouseEventArgs e)
{
var control =
reportSlot.Document.GetControlByUniqueName(e.ElementUniqueName)
as
PerpetuumSoft.Reporting.DOM.TextBox;
if
(control !=
null
)
{
MessageBox.Show(
string
.Format(
"You've clicked on '{0}'"
, control.Text));
}
}
- ElementMarker - an element marker that is set for the element that was clicked. This marker is mostly used in elements’ highlighting scripts for the report viewer (see below for marker description and its use).
Article ID: 561, Created: April 30, 2013 at 10:40 AM, Modified: April 30, 2013 at 10:40 AM