开发者

how can I copy elements after selected them in inkcanavas

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 ?


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜