I need to copy an UIElement
.
I searched for a solution and found this example:
string saved = XamlWriter.Save(canvas1);
StringReader sReader = new StringReader(saved);
XmlReader xReader = XmlReader.Create(sReader);
Canvas newCanvas = (Canvas)XamlReader.Load(xReader);
stackPanel2.Children.Add(newCanvas);
It worked perfectly.
My application copies a long list of UIElement
s and I found that it takes a lot of time.
Does somebody have an idea how to copy UIElement
s faster?