WP7必应地图控件中的图钉的ZIndex [英] ZIndex of pushpins in WP7 bing map control

查看:95
本文介绍了WP7必应地图控件中的图钉的ZIndex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个适用于Windows Phone 7的Bing silverlight地图控件.我试图在当前选择的图钉上显示.这是代码段:

I have a Bing silverlight map control for Windows phone 7. I am trying to display on top currently selected pushpin. Here is the snippet:

<my:Map x:Name="map" Canvas.ZIndex="1" CredentialsProvider="{StaticResource Credentials}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                CopyrightVisibility="Collapsed" LogoVisibility="Collapsed">
            <my:MapItemsControl x:Name="Pushpins">
                <my:MapItemsControl.ItemTemplate >
                    <DataTemplate>
                        <my:Pushpin Location="{Binding Location}" Canvas.ZIndex="{Binding Zindex}" PositionOrigin="0.515625,0.859375" Content="{Binding Id}" Template="{StaticResource PushpinControlTemplate}" Tap="Pushpin_Tap"/>
                    </DataTemplate>
                </my:MapItemsControl.ItemTemplate>
            </my:MapItemsControl>
</my:Map>

该控件将忽略ZIndex.我是否缺少某些内容或不支持ZIndex. ZIndex是实现INotifyPropertyChanged的类的属性

The control is ignoring the ZIndex. Am I missing something or the ZIndex is not supported. The ZIndex is property of a class which implements INotifyPropertyChanged

private int _zIndex;
    public int Zindex
    {
        get { return _zIndex; }
        set
        {
            _zIndex = value;
            OnPropertyChanged(new PropertyChangedEventArgs("Zindex"));
        }
    }

推荐答案

我遇到了同样的问题,即多个图钉靠在一起,并且当我单击图钉时有其他内容可以显示时,该问题更加严重.

I had the same problem where I had multiple pushpins close together and the problem was exacerbated when I had additional content to show when the pushpin was clicked.

我解决此问题的方法是删除图钉,然后重新添加它.这样,它就成为了最高的图钉.

The way I got around this problem was to remove the pushpin and then re-add it. That way it became the topmost pushpin.

map1.Children.Remove(pushpin);
map1.Children.Add(pushpin);

这篇关于WP7必应地图控件中的图钉的ZIndex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆