我的 WP7 bingmap 中的图钉都是黑色的。为什么?

发布于 2024-10-11 14:46:34 字数 1075 浏览 5 评论 0原文

我正在尝试使用 WP7 和 Bingmaps。

我有这个代码

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <my:Map Height="389" HorizontalAlignment="Left" Margin="28,28,0,0" Name="map1" VerticalAlignment="Top" Width="409" />
</Grid>

    public MapInfo()
    {
        InitializeComponent();


        GeoCoordinate lHamburg = new GeoCoordinate(53.550556, 9.993333);

        //map1.Radius = 5000;
        map1.ZoomLevel = 10.0;
        map1.Center = lHamburg;
        map1.CredentialsProvider = new ApplicationIdCredentialsProvider(APPLICATION_ID);

        //Add a pin to the map
        Pushpin pushpin = new Pushpin();
        Location location = new Location();
        location.Latitude = 53.550556;
        location.Longitude = 9.993333;
        pushpin.Location = location;

        map1.Children.Add(pushpin);
    }

但我的图钉是黑色的,没有任何样式。 我是不是忘记了什么?

谢谢, 奥斯卡

编辑:看起来他们是黑人。我必须为其设置某种风格或类似的东西。任何人都可以给我一些关于如何添加简单样式的提示吗?很简单,也许只是改变颜色,或者像谷歌地图那样把它变成圆形或类似的东西。

谢谢, 奥斯卡

I am trying to work with WP7 and Bingmaps.

I have this code

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <my:Map Height="389" HorizontalAlignment="Left" Margin="28,28,0,0" Name="map1" VerticalAlignment="Top" Width="409" />
</Grid>

and

    public MapInfo()
    {
        InitializeComponent();


        GeoCoordinate lHamburg = new GeoCoordinate(53.550556, 9.993333);

        //map1.Radius = 5000;
        map1.ZoomLevel = 10.0;
        map1.Center = lHamburg;
        map1.CredentialsProvider = new ApplicationIdCredentialsProvider(APPLICATION_ID);

        //Add a pin to the map
        Pushpin pushpin = new Pushpin();
        Location location = new Location();
        location.Latitude = 53.550556;
        location.Longitude = 9.993333;
        pushpin.Location = location;

        map1.Children.Add(pushpin);
    }

But my pushpin is black, without any style.
Did I forget something?

Thanks,
Oscar

Edit: it looks like that they ARE black. I would have to set some style to it or something like that. Anyone could give me some hints of how to add a simple style? Very simple, maybe only change the color, or make it round like google maps or something like that.

Thanks,
Oscar

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

真心难拥有 2024-10-18 14:46:34

例如,您可以使用样式:

<Style TargetType="my:Pushpin">
    <Setter Property="Background"
            Value="White" />
</Style>

或在创建它们时直接设置颜色:

    //Add a pin to the map
    Pushpin pushpin = new Pushpin();
    Location location = new Location();
    location.Latitude = 53.550556;
    location.Longitude = 9.993333;
    pushpin.Location = location;
    pushpin.Background = new SolidColorBrush(Colors.Red);

    map1.Children.Add(pushpin);

[注意:我在这里使用了背景属性。您可能需要设置不同的属性才能将其外观更改为所需的状态。]

You can use a style for example:

<Style TargetType="my:Pushpin">
    <Setter Property="Background"
            Value="White" />
</Style>

or directly set color while creating them:

    //Add a pin to the map
    Pushpin pushpin = new Pushpin();
    Location location = new Location();
    location.Latitude = 53.550556;
    location.Longitude = 9.993333;
    pushpin.Location = location;
    pushpin.Background = new SolidColorBrush(Colors.Red);

    map1.Children.Add(pushpin);

[NOTE: I used background property here. You may need to set different property/properties to change it's appearance to needed state.]

守不住的情 2024-10-18 14:46:34

The following MSDN exercise will provide you with all the information that you need: Exercise 2: Handling and Customizing Pushpins. Scroll down to item 5 which is where the customizations of pushpins begins.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文