我正在尝试从Silverlight Bing地图控件向图钉实例添加图像,但似乎无法使其呈现(图钉呈现良好)。这可能是一个普通的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