This seems simple, but it's not working for me. I'd like to display an image from my DB, and overlay a polygon from the same DB, using the same coordinate system.
<Image Name="imgColl" Stretch="Fill" MaxWidth="190" MinHeight="70">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup>
<ImageDrawing ImageSource="{Binding ImageData}" Rect="0,0,590,590"/>
<GeometryDrawing Geometry="{Binding Coordinates, StringFormat=M\{0\}}">
<GeometryDrawing.Pen>
<Pen Thickness="4" LineJoin="Bevel" Brush="OrangeRed"/>
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
I find that I have to specify the Rect on the ImageDrawing object. This is unfortunate because the images I'm loading are of different sizes. But if I don't specify the Rect, the image doesn't appear when running the app. If I make the image big enough (as in the example), the image does appear, and it gets resized to fit my control, but the polygon coordinate system doesn't seem to match.
Also, I've used StringFormat to put an M in front of the Geometry specification, so that it comes out like this: "M50,50,12,50,30,30,30,100,100,100". If I specify that explicitly, the polygon appears, but if I bind it with the same string, the polygon doesn't appear.
Not sure if those two problems are related to one another--I'll have to re-evaluate when either of the two is fixed. Thanks for any guidance you have to offer!