ahigh2

PictureMarkerSymbol Source Does Not Update Properly

Discussion created by ahigh2 on Apr 25, 2013
Latest reply on May 1, 2013 by MBranscomb-esristaff
Hello,

If I am using a PictureMarkerSymbol with a BitmapImage as the Source property in a GraphicsLayer and change the Source property the symbol does not update. However, if I set the source to some other value and then immediately set it back to the BitmapImage it works properly. See example below:

PictureMarkerSymbol markerSymbol = new PictureMarkerSymbol();
markerSymbol.Geometry = new MapPoint(0,0);

//This method doesn't work:
private void changeSymbol()
{
    //ASSUMPTIONS: "this.bitmap" is being updated by some external class/method before the changeSymbol() method is called
    markerSymbol.Source = this.bitmap;
}

//This method does:
internal static BitmapSource dummyBitmap = BitmapSource.Create(1, 1, 8, 8, PixelFormats.Indexed1, BitmapPalettes.BlackAndWhiteTransparent, new byte[1], 1);

private void changeSymbol()
{
    //ASSUMPTIONS: "this.bitmap" is being updated by some external class/method before the changeSymbol() method is called
    markerSymbol.Source = dummyBitmap;
    markerSymbol.Source = this.bitmap;
}


This would be used in a case where the "this.bitmap" is being updated on a timer and the changeSymbol() is called after the update on the same timer tick. Am I missing something here?

Thanks.

Outcomes