Saturday, 24 August 2013

How to serialize a page with all controls that it contains

How to serialize a page with all controls that it contains

I'm quite new with the programming so please, don't be too hard in your
answers :-) I'm writing an app where in a page, or better in a grid of a
XAML page, I've put a couple of buttons, written directly in XAML (let's
call them "button1" and "button2"), and where it is possible to add two
more buttons in runtime ("button3" and "button4". Moreover, it is possible
to remove one or more of these buttons, included the ones created in XAML.
Till here there isn't any problem.
Obviously, if the status of the page, with the buttons present at the
moment, is not saved in the isolated storage, when the app is re-open I
find only the two buttons created in XAML. This is the tricky part of the
program. As far as I know, I should serialize the controls and then save
them in the isolated storage. I'd like to know if it is possible to
serialize the entire page with the controls present on it (if yes, how
should I proceed?) or if it is necessary to serialize every single control
(how to do that?) taking into account that, as written, not all buttons
could be present.
I tried to search in the Internet but I didn't find anything which could
help me with a clear example. I just know how to serialize arrays or save
strings in the isolated storage but this is new to me.
Thank you in advance

No comments:

Post a Comment