Visual Basic (Declaration) | |
---|---|
Public Property MapTip As FrameworkElement |
C# | |
---|---|
public FrameworkElement MapTip {get; set;} |
A KmlLayer.MapTip is a FrameworkElement that displays a visual popup containing information associated with a Graphic. Defining the User Interface (UI) look of the FrameworkElement for a KmlLayer.MapTip can be done in either XAML (see the code example in this document) or code-behind.
There are several sources of where the information that is displayed in a KmlLayer.MapTip can come from:
- The information is stored in the Graphic.Attributes of the KmlLayer.
- The information is hard coded
- The information is generated on the fly based upon user interaction with the Map
You can use a binding expression in XAML to bind the Attributes of the GraphicsLayer (embedded in the KmlLayer) to the DataContext Property of the Graphic. The general usage syntax follows the pattern:
<esri:KmlLayer>
<esri:KmlLayer.MapTip>
<StackPanel Orientation="Horizontal" Background="White">
<TextBlock Text="KML Placemark Name:" />
<TextBlock Text="{Binding [SomeAttributeName]}" />
</StackPanel>
</esri:KmlLayer.MapTip>
<esri:KmlLayer>
Tip: Developers can perform DataContext binding directly to Dictionary Keys by specifying the Key name in brackets. Therefore when binding the DataContext of a KmlLayer.MapTip to a specific attribute name in the Graphic.Attributes (which is a Dictionary), encase the attribute name in square brackets (i.e. []). Example: <TextBlock Text="{Binding [name]}" /> or the slightly more verbose version <TextBlock Text="{Binding Path=[name]}" />).
The following KML tags map to Attributes in a GraphicsLayer that can be used for binding to a KmlLayer.MapTip: <atom:author> 'name' attribute, <atom:link> 'href' attribute, ' <atom:name> 'href' attribute, <BalloonStyle><text> information, <description> information, <name>, and <ExtendedData>.
The <ExtendedData> tag maps internally to the ESRI.ArcGIS.Client.Toolkit.DataSources.Kml.KmlExtendedData Class. Each KmlExtendedData object has three Properties: 'DisplayName', 'Name', and 'Value' that can have attribute information. In order to use binding from a KmlLayer.MapTip to a KmlExtendedData object, developers must create their own custom converter. See the code example in this document for one possible way to use a custom converter for the KmlExtendedData Class. Additional discussion on the use of the KML <ExtendedData> tags can also be found in ArcGIS Resource Center in the Forum thread entitled: KMLLayer use of identify or maptips.
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8