laptop and a wrench

Bug

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, 2014 No Product Found
Bug ID Number NIM091177
SubmittedMay 2, 2013
Last ModifiedJune 5, 2024
Applies toNo Product Found
Version found10.1
Version Fixed1
StatusFixed

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;

Steps to Reproduce

Bug ID: NIM091177

Software:

  • No Product Found

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options