Here's an example in C#, although I apologise its more of a code dump than an explanation of how to do it.
http://alski.net/post/2012/01/11/WPF-Icon-Overlays.aspx
The important bit is this which takes a Visual and converts it into a bitmap. The IconOverlay is bound to the generated bitmap.
public static BitmapSource GenerateBitmapSource(Visual visual, double renderWidth, double renderHeight)
{
var bmp = new RenderTargetBitmap((int)renderWidth, (int)renderHeight, 96, 96, PixelFormats.Pbgra32);
var dv = new DrawingVisual();
using (DrawingContext dc = dv.RenderOpen())
{
dc.DrawRectangle(new VisualBrush(visual), null, new Rect(0, 0, renderWidth, renderHeight));
}
bmp.Render(dv);
return bmp;
}