views:

219

answers:

2

I want to remove geometry from canvas in Silverlight... I am able to remove it but removal is not immediately reflected. I mean when I perform GeometryGroup.Children.Remove(geometry) it is removing from tree but not from Canvas... Surprisingly removed geometry is still visible in the Canvas until I perform some mouse action.

Can anyone please tell me, what is the correct way of removing geometry?

Thank you very much.

A: 

Try a call to InvalidateArrange() or InvalidateMeasure() on the Canvas to cause a repaint.

James Cadd
I tried calling both the methods and it is still not working...
Software Enthusiastic
A: 

I thing I got the answer, it is working but the approach seems to be unusual or indirect... Here is what I am doing...

//Following line causing geometry to disappear from the Canvas
geometry.Transform = new ScaleTransform{ ScaleX = 0, ScaleY = 0};
geometryGroup.Children.Remove(geometry);
Software Enthusiastic