WPF Visualizer
Visual Tree
canvas
canvas.Children.Add poly |> ignore
Specified Visual is
- already a child of another Visual or
- the root of a CompositionTarget.
Don’t think it’s 1), not sure what 2) is?
Using Visual Studio 2010, F# 2.0, WPF, … not XAML
It’s a bit hard to diagnose the problem without a relevant code sample, but maybe the problem is that you tried to add the same polygon to the canvas’ children twice.
This is the code I burped up to reproduce your error:
If I add another
canvas.Children.Add polyit crashes with your error message.In order to fix the error, I first called
canvas.Children.Removeto remove the specific child that was present in order to replace it by another.I hope this fixes your problem.