PictureMarkerSymbol does not update when the PictureMarkerSymbol.Source property is changed and the source is a BitmapImage created via BitmapImage.StreamSource.
Last Published: August 25, 2014No Product Found
Bug ID Number
NIM091177
Submitted
May 2, 2013
Last Modified
June 5, 2024
Applies to
No Product Found
Version found
10.1
Version Fixed
1
Status
Fixed
The bug has been fixed. See the Version Fixed and Additional Information, if applicable, for more information.
Workaround
There are several options when referring to images used as the Source for a PictureMarkerSymbol:Note:- The following examples assume the image is in a folder called "Images".#1. The image is included in the project and the Build Action is "Resource": Use the Pack URI scheme e.g.:BitmapImage bi0 = new BitmapImage();bi0.BeginInit();bi0.UriSource = new Uri("pack://application:,,,/Images/MyImage.png");bi0.EndInit();PictureMarkerSymbol pms = new PictureMarkerSymbol();pms.Source = bi0;#2. The image is included in the project and the Build Action is Content: Use absolute Uri e.g.:Note:- Ensure image is in output location (set Copy to Output Directory to "Copy if Newer" / "Copy Always")BitmapImage bi0 = new BitmapImage(new Uri(Path.Combine(Environment.CurrentDirectory, "Images", "MyImage.png")));PictureMarkerSymbol pms = new PictureMarkerSymbol();pms.Source = bi0;#3. Image is in memory (or needs to be modified in memory):ImageBrush simpleArrow = new ImageBrush();simpleArrow.ImageSource = new BitmapImage(new Uri("<a href="http://static.arcgis.com/images/Symbols/Basic/ArrowYellow.png" target="_blank">http://static.arcgis.com/images/Symbols/Basic/ArrowYellow.png</a>"));// Add an Ellipse Element & use the ImageBrush as the Fill for the EllipseEllipse myEllipse = new Ellipse();myEllipse.Fill = simpleArrow;myEllipse.HorizontalAlignment = HorizontalAlignment.Center;myEllipse.VerticalAlignment = VerticalAlignment.Center;myEllipse.Width = 24;myEllipse.Height = 24;// Rotate by the angle 90 and about the center of the 24x24 pixel image.myEllipse.RenderTransform = new RotateTransform(90, 12, 12);//Force a rendermyEllipse.Measure(new System.Windows.Size(Double.PositiveInfinity, Double.PositiveInfinity));myEllipse.Arrange(new Rect(myEllipse.DesiredSize));RenderTargetBitmap render = new RenderTargetBitmap(34, 34, 96, 96, PixelFormats.Default);render.Render(myEllipse);PictureMarkerSymbol pms = new PictureMarkerSymbol();pms.Source = render;