Highlighting
- 2 minutes to read
The Map control supports map vector item highlighting.
This topic consists of the following sections.
Enable Highlighting
To enable the highlighting functionality, set the VectorLayerBase.EnableHighlighting property to true.
When you need to display the highlighted item above other layer items, set the VectorLayerBase.IncreaseItemZIndexInInteraction property to true.
The following images represent this property in action.
The property value | The resulting image |
---|---|
IncreaseItemZIndexInInteraction = true | |
IncreaseItemZIndexInInteraction = false |
Customize the Highlighted Item Appearance
To configure the highlight appearance of an individual map item, use the following properties.
- The MapShapeBase.HighlightFill property defines a brush used to fill the highlighted map item.
- The MapShapeBase.HighlightStroke property sets a brush used to paint the highlighted item outline.
- The MapShapeBase.HighlightStrokeStyle property specifies parameters of the highlighted map item’s outline, for example, the outline thickness.
Use XAML below to add a MapEllipse object with defined highlighting settings to a VectorLayer.
<dxm:VectorLayer>
<dxm:MapItemStorage>
<dxm:MapEllipse Location="70, -33"
Width="3500" Height="3500"
Fill="AliceBlue"
HighlightFill="Red"
HighlightStroke="Black">
<dxm:MapEllipse.HighlightStrokeStyle>
<dxm:StrokeStyle DashArray="10 1 5"
Thickness="5"
DashCap="Round"/>
</dxm:MapEllipse.HighlightStrokeStyle>
</dxm:MapEllipse>
</dxm:MapItemStorage>
</dxm:VectorLayer>
If you need to define the highlight appearance of all vector layer items, use the following properties.
- The VectorLayerBase.HighlightShapeFill property defines a brush used to fill the highlighted map item.
- The VectorLayerBase.HighlightShapeStroke property sets a brush used to paint the highlighted item outline.
- The VectorLayerBase.HighlightShapeStrokeStyle property specifies parameters of the highlighted map item’s outline, for example, the outline thickness.
Use the XAML below to set the common appearance settings to all vector layer items while they are highlighted.
<dxm:VectorLayer
HighlightShapeFill="Coral"
HighlightShapeStroke="Black">
<dxm:VectorLayer.HighlightShapeStrokeStyle>
<dxm:StrokeStyle DashArray="1 3"
Thickness="2"
DashCap="Round"/>
</dxm:VectorLayer.HighlightShapeStrokeStyle>
<!--…-->
</dxm:VectorLayer>