Skip to main content
Home Forums Silverlight Programming Programming with .NET - General clone usercontrol
3 replies. Latest Post by tamirk on May 14, 2008.
(0)
starsign
Member
90 points
37 Posts
05-13-2008 1:20 AM |
Hi,
I want to make a clone of a usercontrol at runtime to get an exqact copy of it. There seems to be no binaryformatter in Silverlight so I thought about using DataContractSerializer. My code is below but I get an error when this is run within the usercontrol iteself (it does seem to work on a normal class) - the error says Type not serializable so my first guess is that the XAML may need a tag to allow it to be serialized?
reader.Close();
ms.Close();
Any help would be really appreciated.
Thanks
tamirk
100 points
23 Posts
05-13-2008 4:02 AM |
You can use my "reflection" approach to create deep clone of UserControl.
05-14-2008 1:56 AM |
thanks - does that clone the contents of member variables from the code behind class too?
05-14-2008 2:01 AM |
yes