(1)创建任何UIElement以传递到pushpinLayer.AddChild. AddChild方法将接受任何UIElement,例如本例中的图像:
MapLayer m_pushpinLayer = new MapLayer();Your_Map.Children.Add(m_pushpinLayer);Image image = new Image();image.source = Resourcefile.GetBitmap("Images/Me.png",From.This);image.WIDth = 40;image.Height = 40;m_pushpinLayer.AddChild(image,new Microsoft.Maps.MapControl.Location(42.658,-71.137),positionOrigin.Center);
(2)创建一个本机pushpin对象以传递到pushpinLayer.AddChild,但首先设置它的Template属性.请注意,pushpin是ContentControls,并且具有可以从XAML中定义的资源设置的Template属性:
MapLayer m_pushpinLayer = new MapLayer();Your_Map.Children.Add(m_pushpinLayer);pushpin pushpin = new pushpin();pushpin.Template = Application.Current.Resources["pushpinTemplate"] as (ControlTemplate);m_pushpinLayer.AddChild(pushpin,positionOrigin.Center);<ResourceDictionary xmlns="http://schemas.microsoft.com/clIEnt/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ControlTemplate x:Key="pushpinTemplate"> <GrID> <Ellipse Fill="Green" WIDth="15" Height="15" /> </GrID> </ControlTemplate></ResourceDictionary>总结
以上是内存溢出为你收集整理的Silverlight – Bing地图 – 自定义图钉样式全部内容,希望文章能够帮你解决Silverlight – Bing地图 – 自定义图钉样式所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)