Image as pushpin on maps - Windows phone 8

后端 未结 1 1016
刺人心
刺人心 2021-01-03 14:25

im trying to add a image to a windows phone 8 map, to serve as a pushpin

i have the following code on my XAML



        
1条回答
  •  孤街浪徒
    2021-01-03 14:46

    Use the Phone.Controls.Toolkit as described here:-

    http://wp.qmatteoq.com/maps-in-windows-phone-8-and-phone-toolkit-a-winning-team-part-1/

    The toolkit can be found at either of

    http://phone.codeplex.com/

    or

    https://www.nuget.org/packages/WPtoolkit

    You can then either add the image directly in your XAML as follows:-

    
       
           
               
                   
                       
                           
                        
                    
                
            
        
    
    

    or you can add it in C# as follows:-

    MapOverlay overlay = new MapOverlay
    {
        GeoCoordinate = myMap.Center,
        Content = new Ellipse
        {
            Fill = new SolidColorBrush(Colors.Red),
            Width = 40,
            Height = 40
         }
    };
    MapLayer layer = new MapLayer();
    layer.Add(overlay);
    
    myMap.Layers.Add(layer);
    

    You should be able to add a Grid with an image instead of an ellipse as shown above.

    Let me know if this worked for you.

    0 讨论(0)
提交回复
热议问题