WPF RichTextBox serialization for XAML and RTF

I have RichTextBoxand need to serialize its contents in my database solely for storage purposes. It would seem that I have a choice between serializing as XAML or RTF, and I'm wondering if there are any advantages to serializing for XAML compared to RTF, which I consider to be more "standard".

In particular, am I losing any opportunity by serializing RTF instead of XAML? I understand that XAML supports custom classes inside a FlowDocument, but I am not currently using any custom classes (although the potential for extensibility may be a good reason to use XAML).

Update: I ended up working with RTF due to support for text encoded images. XAML doesn't seem to include image data in its encoding, and XamlPackage is encoded in a binary, so RTF works better for me. So far, I have not noticed a lack of opportunities.

+5
source share
2 answers

If all your users do input to RichTextBox and do character formatting, RTF is as good as XAML. However, there are many FlowDocument features that you can use in your user interface that cannot be converted to RTF.

FlowDocument ( RichTextBox), RTF -:

  • BorderBrush, , VisualBrush
  • HasTrailingParagraphBreakOnPaste
  • Floater/ClearFloaters -.
  • / ,
  • WPF ResourceDictionaries Resources
  • WPF, CheckBox .., RichTextBox .

, , / " /" RichTextBox, . , RichTextBox , InlineUIContainer . .

, FlowDocument RTF , , XAML. , XAML - XamlPackage. XamlPackage [], Base64 .

, , , , RTF. FlowDocuments, , .

+5

All Articles