WPF control deep clone

Original: WPF Control Deep Clone

http://social.msdn.microsoft.com/Forums/zh-SG/wpfzhchs/thread/e5c87129-966a-4d51-a934-ccb8fc7620ec

 

For example, there is a RichTextBox1 in the canvas. Now I want to create a new RichTextBox2, copy the content events of RichTextBox1 to RichTextBox2, and the two can coexist in the canvas; is there a simple clone similar to Winform?

 

string xaml =System.Windows.Markup.XamlWriter.Save(rtb1);RichTextBox rtb2 =System.Windows.Markup.XamlReader.Parse(xaml)asRichTextBox;
           

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325216441&siteId=291194637