Hi Tean,
Below code working for save the content.string rtbContent = XamlWriter.Save(rtb.Document);
File.WriteAllText(@"C:\Temp\" + Guid.NewGuid() + ".xaml", rtbContent);
while opening the file in IE if file having image means it showing errors,if no image in xaml means file opens with out error.