Multiple controls in canvas creating same name issue


Hi ,
I have a canvas and i am porting all my dynamically created controls to this canvas . When i do this :
XamlWriterSettings set = new XamlWriterSettings();
        set.WriteDefaultValues = false;

        string fullXaml = XamlWriter.Save(containerCanvas,set);
UIElement xamlElement = (UIElement)System.Windows.Markup.XamlReader.Load(fullXaml);
i get an error saying that there is samme name issue in the controls .
I verified this and this is coming from the default values created around the " control" like for Button , i get border and other default values created and these have default names which remain the same even if they are different controls. Could you tell me how i can manage this ?