开发者

WPF How to erase a DrawingVisual with RemoveVisualChild

Using WPF I'm drawing symbols in the "fast way" (Drawing rendered on DrawingVisuals, no Shapes). So... I can successfully draw them and get hit-tested with no problem. But when trying to remove them, using RemoveVisualChild() plus RemoveLogicalChild(), there is no effect on the screen: No visual removing.

I'm implementing my own displaying canvas-alike object (overriding VisualChildrenCount, GetVisualChild, MeasureOverride and ArrangeOverride).

For a while I believed it was a problem of refresh, but after invoking many methods (InvalidateMeasure, InvalidateArrange, InvalidateViual and UpdateLayout, plus a Dispatcher calling technique for post background-threading execution) well... the supposedly erased objects are still there.

A curious thing is that new开发者_运维百科 objects going to be drawn OVER these erased ones, are in fact rendered UNDER them!!

Any Ideas?


SOLVED: It was my mistake (what a shame!)... A recursive symbol update, started at property setter level, was repainting the object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜