How to clone a WPF grid with all children?

bikerjeg

New Member
I have several controls in my WPF window. I have divided the window into 4 sections. If I click on the section in the upper left, I want to copy the contents of this section in another window popup.What I want to copy is a grid that can contain a lot of different controls, ex: togglebutton, button, panel... derived from ItemsControl, Control... and with DependencyProperty, ObservableCollection etc..I tried :
  • XamlWriter.Save(data);
  • XamlServices.Save(data);
but I always have these errors :\[quote\]
  • Cannot serialize a generic type 'System.Collections.ObjectModel.ObservableCollection`1 or
  • A BadImageFormatException has been thrown while parsing the signature. This is likely due to lack of a generic context. Ensure genericTypeArguments and genericMethodArguments are provided and contain enough context.
\[/quote\]
 
Back
Top