【问题标题】:Telerik MapPinPoint position cannot be set correctlyTelerik MapPinPoint 位置无法正确设置
【发布时间】:2017-03-10 16:02:58
【问题描述】:

我正在使用 Telerik RadMap 和 VisualisationLayer 在地图上显示邮政编码的形状。

<telerik:VisualizationLayer ItemsSource="{Binding MapItemCollection}" x:Name="VisualizationLayer">
    <telerik:VisualizationLayer.ItemTemplate>
        <DataTemplate>
            <telerik:MapPolygonView telerik:MapLayer.Location="{Binding MapItemLocation}" Points="{Binding MapItemPoints}" local:MapUtility.ShapeColor="{Binding MapItemColor}"/>
        </DataTemplate>
    </telerik:VisualizationLayer.ItemTemplate>
</telerik:VisualizationLayer>

到目前为止,一切正常,但是当我试图给这个形状一个 Telerik.MapPinPoint 作为这个形状中心的标题时。 PinPoint 的位置被邮政编码形状的位置覆盖,因此它们位于形状的边缘而不是中心。

<telerik:VisualizationLayer ItemsSource="{Binding MapItemCollection}" x:Name="VisualizationLayer">
    <telerik:VisualizationLayer.ItemTemplate>
        <DataTemplate>
            <telerik:MapPolygonView telerik:MapLayer.Location="{Binding MapItemLocation}" Points="{Binding MapItemPoints}" local:MapUtility.ShapeColor="{Binding MapItemColor}"/>
        </DataTemplate>
    </telerik:VisualizationLayer.ItemTemplate>
</telerik:VisualizationLayer>

<telerik:VisualizationLayer ItemsSource="{Binding MapItemCollection}" x:Name="Layer">
    <telerik:VisualizationLayer.ItemTemplate>
        <DataTemplate>
            <telerik:MapPinPoint telerik:MapLayer.Location="{Binding PinPointLocation}"
                Background="#80808080"
                Foreground="White"
                BorderBrush="Black"
                BorderThickness="1"
                Text="{Binding PinPointText}"/>
            </DataTemplate>
    </telerik:VisualizationLayer.ItemTemplate>
</telerik:VisualizationLayer>

我现在的解决方法是为 PinPoint 获取 MapItem 类的另一个实例,并将该实例的 MapItemLocation 设置为 Location.Empty。当我这样做时,它也可以正常工作,但我希望在一个实例中将所有考虑到一种形状和邮政编码的信息放在一起。

【问题讨论】:

    标签: c# wpf telerik


    【解决方案1】:

    所以我得到了 Telerik Support 的答复,我还要求解决我的问题。

    他们的解决方案是将 UseDefaultPropertyAccessor 设置为 false。

    <telerik:VisualizationLayer ItemsSource="{Binding MapItemCollection}" x:Name="Layer" UseDefaultPropertyAccessor="False">
    <telerik:VisualizationLayer.ItemTemplate>
        <DataTemplate>
            <telerik:MapPinPoint telerik:MapLayer.Location="{Binding PinPointLocation}"
                    Background="#80808080"
                    Foreground="White"
                    BorderBrush="Black"
                    BorderThickness="1"
                    Text="{Binding PinPointText}"/>
        </DataTemplate>
    </telerik:VisualizationLayer.ItemTemplate>
    

    这解决了问题,现在可以按预期工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-05
      • 2012-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-29
      • 2017-01-03
      • 2018-07-01
      相关资源
      最近更新 更多