Trying to create visualizers for some WPF elements including DrawingImage
and UIElement
etc. While creating a visualizer was trivial, my visualizers always throw exception that the target object types (DrawingImage
and UIElement
that is) are not marked as serializable.
Further reading revealed that I need to implement VisualizerObjectSource
to provide custom serialization. This class is specified as one of the arguments in DebuggerVisualizer
attribute. I followed these steps and now my custom serializer gets called, but I don't really know what to do in there. Here is the relevant function that gets called:
public override void GetData(object target, Stream outgoingData)
{
var writer = new StreamWriter(outgoingData);
writer.WriteLine(/*???*/);
writer.Flush();
}
Don't understand exactly what it is expecting from me (a binary-serialized version of the UIElement
?) and exactly how do I write a UIElement
or a DrawingImage
to the outgoing stream. Anyone has done this before?