I have an Application (an appointment manager) which lets the user create usercontrols in a stackpanel per button click and the user can enter data into the usercontrols. So far so good.
I serialized the stackpanel with XamlWriter.Save(). But then when I try to load it again the next time the application starts with XamlReader.Load() I get the following exception:
"System.Windows.Markup.XamlParseException: Cannot set Name attribute value 'border1' on element 'Border'. 'Border' is under the scope of element 'Item', which already had a name registered when it was defined in another scope. Line '4' Position '43'."
I found a workaround in google involving removal of all control names which seem not to be useful for me.
Now you could ask, why do you have to use Xml-Serialisation at all. The thing is, that we have to create a science projekt for our xml-course, in which at least xml-serialisation and xslt must be used, so I thought this would be a great idea :(