Having trouble getting help?
Contact Support
Contact Support
Events in WPF Maps (SfMap)
23 Jul 20213 minutes to read
• ZoomedIn
- Occurs whenever zooming the map.
• ZoomedOut
- Occurs when zoomed out the map.
• Panning
- Occurs while panning the map.
• Panned
- Occurs after panned the map.
• MapToolTipOpening
- Occurs when any tooltip on the SfMap control is opened.
Tooltip opening event
MapToolTipOpening
event occurs whenever you select a shape, bubble, or marker. You will get the Data
and TooltipType
properties as arguments from TooltipOpeningEventArgs
handler, and you can cancel the event for a particular shape using the Cancel
property.
<maps:SfMap MapToolTipOpening="Map_MapToolTipOpening" >
<maps:SfMap.Layers>
<maps:ShapeFileLayer Uri="MapsZoom.ShapeFiles.usa_state.shp" ItemsSource="{Binding Data}"
ShapeIDPath="State" ShapeIDTableField="STATE_NAME"
EnableSelection="False" LabelPath="State">
<maps:ShapeFileLayer.ShapeSettings>
<maps:ShapeSetting ShapeStrokeThickness="1" ></maps:ShapeSetting>
</maps:ShapeFileLayer.ShapeSettings>
<maps:ShapeFileLayer.ToolTipSettings>
<maps:ToolTipSetting ValuePath="Candidate" x:Name="shapeTooltipSettings" >
</maps:ToolTipSetting>
</maps:ShapeFileLayer.ToolTipSettings>
</maps:ShapeFileLayer>
</maps:SfMap.Layers>
</maps:SfMap>
private void SfMaps_TooltipOpening(object sender, TooltipOpeningEventArgs e)
{
if ((e.Data is MapsZoom.ElectionData) && (e.Data as MapsZoom.ElectionData).State == "North Dakota")
{
e.Cancel = true;
}
}
NOTE
You can refer to our WPF Map feature tour page for its groundbreaking feature representations. You can also explore our WPF Map example to know how to render and configure the map.