1

I tried to use Inkcanvas.copy()and Inkcanvas.Paste() but it failed so I save the elements in list and then tried to add them again as a child in the inkcanvas but I got exception error

Specified Visual is already a child of another Visual or the root of a CompositionTarget.

so what should I do ?

akjoshi
  • 15,374
  • 13
  • 103
  • 121
kartal
  • 17,436
  • 34
  • 100
  • 145

1 Answers1

0

You can serialize the selected element(when copying) using XamlWriter.Save, and de-serialize/load(when Pasting) using XamlReader.Load. But there are issues with serializing and de-serializing using XamlReader/XamlWriter which you will have to take care of(you can find a lot of help regarding that on SO and web).

You can have a look at this article having this implementation for Custom Canvas -

WPF Diagram Designer - Part 4

akjoshi
  • 15,374
  • 13
  • 103
  • 121