Error in loading the serialized canvas object
I'm getting an error while loading a serialized object of canvas.
I have a WPF window on which user can create UI objects at runtime by drag-drop operation.
I have a Canvas object created by drag-drop operation. This canvas has few child controls.
It is then serialized using XAMLWriter.Save method.
While deserializing the same canvas object, following error comes on XamlReader.Load() method.
"Cannot set Name attribute value <controlname> on element 'TextBlock'. 'TextBlock' is under the scope of element <Canvas>, which already had a name registered when it was defined in another scop"
While de-serializing the canvas, child control's "Name" property is not accepted by the XAMLParser.
How should I serialize and deserialize canvas object such that it can be parsed without any error?