ArcGIS for Silverligth的MapTip通过模板设置

在FeatureLayer的Initialized事件中,MapTip通过Template加载自定义的控件模板,然后创建一个Canvas承载MapTip,并添加到页面上。

Private Sub FeatureLayer_Initialized(ByVal sender As Object, ByVal e As EventArgs)
    Dim c As Canvas = New Canvas
    Dim mt As MapTip = New MapTip() With {.Template = CType(Application.Current.Resources("myMapTipTemplate"), ControlTemplate)}
    mt.GraphicsLayer = fl
    c.Children.Add(mt)
    LayoutRoot.Children.Add(c)
End Sub

 自定义的控件模板如下:

<ControlTemplate x:Key="myMapTipTemplate">
    <Grid>
        <StackPanel>
            <TextBlock Text="测试" />
        </StackPanel>
    </Grid>
</ControlTemplate>
原文地址:https://www.cnblogs.com/tulife/p/2303500.html