The possibility to highlight the groups of elements has been introduced in product version 6.5. This function is convenient for use in conjunction with ElementClick and ElementHover events to highlight the area on which a mouse click was performed or above which the mouse cursor is placed.
WPF ReportViewer utilizes the following highlight methods:
, Brush> colorizer)
, Brush> colorizer,
The HighlightControls method is used for highlighting the elements.
The Colorizer function for each marker determines whether the marked elements should be highlighted and what Brush is used. The function for the specified marker should return either the Brush value, which will highlight the elements, or the null value, if there's no need to highlight the elements with this marker. A function can be called once for each page for each unique value of the marker. In addition, the function will be saved and then used for highlighting the newly loaded pages. It should be kept in mind in order to avoid problems with an access to the objects in incorrect state.
Besides, the results of HighlightControls method calls are not summed up, but replaced. So, for example, instead of calling the function separately to highlight a row and a column, we should call a method by passing a function that will highlight both the row and the column.
The Opacity property default value is “0.3” and it determines what transparency level should be applied to a highlighted element. If “1” value is specified, then the highlighted elements will be completely invisible. The highlight selection becomes transparent when “0” value is specified.
Note that when the page is loaded, the elements with markers are grouped; thereby the less unique markers are used in the report the better is the performance and resource consumption. Besides, it is better not to create unused markers in the report since system resources are wasted for their processing.
The ResetHighlight method resets elements highlighting.
Note that the report elements rather than the field in the document are highlighted. Thus, there is no possibility to highlight an area that is void of elements or the area which is not tied to report elements.
For example, we need to highlight a table row with the mouse cursor hovering over it. Remember that we set a marker which equals the table row for each highlighted element. Thus, we need to highlight the elements with a marker obtained through arguments of the ElementHover event:
sender, ReportElementMouseEventArgs e)
// No elements under the cursor.
x => e.ElementMarker == x ?