Marking the Elements
SharpShooter Reports introduces the possibility to set markers for the report elements which are later used by WPF ReportViewer to highlight element groups.
The marker is set by the use of Marker element property. This property supports bindings for script based calculation. Keep in mind that the property belongs to “string” type, that’s why it’s necessary to remember that any specified value would be converted to “string” type as a result. Thereby, if a class used as a marker, for example, returns its name with ToString() method, then all report elements will have the same marker, despite the fact that values of class fields can vary. Another feature is that if a mark value is not set directly for the element, then the attempt to get the mark value of the container that contains the element is performed. This seems very convenient. For example, setting a single property value for detail element, instead of performing this for each textbox in detail element, will make all nested textboxes inherit it.
Let’s say we have the following report structure:
We want to mark every line of the table with an individual marker. It’s very convenient to use “dataBand1.LineNumber” expression for this purpose, as this will produce the unique value for each line. Since the marker value will be inherited from the parent element we will need to set it only for detailCustomers (provided that the value was not set for textboxes):
Please note, that a computed value of the expression is inherited for the Marker property rather than the expression that calculates marker. Thus, if you set a marker for the detail1 element which equals Path value (full path to the item with the index in iterative controls, see below for more details), then all the elements of the detail will eventually have the same marker which equals Path value of the Detail element. In case we set the Marker value which equals Path value for each textbox inside Detail element individually, then each of them will have an individual Marker value.