Converting XAML to Microsoft format using MsRichTextBoxXamlFormatProvider (Hyperlinks Missing)

2 posts, 0 answers
  1. Eric Langland
    Eric Langland avatar
    11 posts
    Member since:
    Jun 2005

    Posted 03 Nov 2011 Link to this post

    I'm using a RadRichTextBox to edit some data which will eventually end up in a windows phone app. I noticed that the native XAML format that is generated by the Rad control doesn't render in standard Microsoft XAML controls so I'm using the

    formatter to translate the XAML into the format that works for me. The problem I'm seeing is that when I translate the XAML, Hyperlinks seem to go missing. It just creates blue underlined text instead of giving me actual hyperlink XAML.

    Here's the code I'm using to translate the XAML.
    MsRichTextBoxXamlFormatProvider provider = new MsRichTextBoxXamlFormatProvider();              
    string xaml = provider.Export(rtbBody.Document);

    Any ideas?
  2. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 04 Nov 2011 Link to this post

    Hi Eric Langland,

    Currently exporting hyperlinks to MS RichTextBox's XAML is indeed not supported. One of the reasons is that there is a difference in the document models that does not allow exact parallel between the two Hyperlink types.
    RadDocument's hyperlinks are presented in the document by two inline document elements marking the start and end of the hyperlink - HyperlinkRangeStart and HyperlinkRangeEnd. This allows that hyperlinks span more than one block (Paragraph, TableCell, etc.) and there can be other inline elements between them (e.g. images). The document structure is best illustrated in the scheme on this page. This is not supported in MS FlowDocument, where Hyperlinks are inline elements.

    We will consider introducing some kind of conversion, but proper behavior in all cases will probably be impossible to achieve.

    Kind regards,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top