Essentially, I build a collection of xaml elements with their attributes and child elements, and when the time is right, I call the GetXaml() method. (And this is where I realized the whole thing was a waste of time because I could have just saved a collection of strings that represented the xaml in question.)