简体   繁体   中英

Setting the xaml of the Silverlight 4 RichTextBox

I can retrieve the xaml with rtb.xaml.ToString() and store it in a database. But how do I set it? As an example, I thought rtb2.Xaml = rtb.Xaml would work.

The Xaml property is a of type String so there is no need to use ToString on it.

You simply store the content of Xaml as a string in a database and restore it later with a simply assignment:-

 rtb.Xaml = myXamlString;

Howeever you should note that only a limited number of elements will actuall serialise in this wa, you can't expect embedded controls like ComboBox to serialise. In addition only relevant properties of the remaining elements will serialise, again those related to the appearance of the text.

For details see the documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM