我试图将图像添加到从Silverlight的必应地图控件图钉实例,但我似乎无法得到它的渲染(图钉呈现罚款)。这可能是一个一般WPF问题,而不是特定于对象图钉任何东西。

Pushpin pp = new Pushpin();
...

Uri imageUri = new Uri(@"myImage.png", UriKind.Relative);

BitmapImage image = new BitmapImage(imageUri);

ImageBrush imageBrush = new ImageBrush();
imageBrush.ImageSource = image;

pp.Foreground = imageBrush;

myMap.Children.Add(pp);
有帮助吗?

解决方案

我可以,只要我把它添加到后台看到“myImage.png”呈现在我的图钉之上。

pp.Background = imageBrush
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top