FlowDocument for WinRT RRS feed

  • Question

  • We are working on a application which renders richtext using WPF FlowDocument. Silverlight has limited support for richtext in RichtextBox etc. But winRT seem to be even more limited. From what I can understand, Paragraph is the only Block element supported no Figure, Floater or Section support. Which is fine provided.

    1. I can load and save the richtext to a file like XamlPackage format in FlowDocument.

    2. Some means to implement Annotations.


    A philosophical question I'm asking myself is, should I simply be using WebView to render the documents, obviously it will not have support for Annotations etc. and the rendering may not look as impressive as it looks on flowDocuments.

    Any thought, suggestions will be gratefully received.



    Sameer V.
    Monday, October 10, 2011 2:37 PM


  • From Expert: 

    We do not have FlowDocument in WinRT.  There is support for creating linked text containers (RichTextBlock, RichTextBlockOverflow), but not the level of annotation support that you are looking for right now.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    Thursday, October 13, 2011 3:24 PM

All replies

  • Hi Sameer - I'll see what our experts have to say about this and either post the response or have one of them do it.
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    Tuesday, October 11, 2011 7:27 PM
  • Many thanks, Matt
    Sameer V.
    Wednesday, October 12, 2011 9:56 AM
  • From Expert: 

    We do not have FlowDocument in WinRT.  There is support for creating linked text containers (RichTextBlock, RichTextBlockOverflow), but not the level of annotation support that you are looking for right now.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    Thursday, October 13, 2011 3:24 PM
  • OK. just a couple of questions then,

    1. Is RichtextBlock virtualized.

    2. This is a vague question but I want your opinion. Is it technically possible to write an FlowDocument like control on WinRT? Admittedly I have not done a lot of work on winRT, but I found it to be limited compared to Silverlight and (certainly)WPF. Absence of Behaviours, Adorners etc. will pose a challenge.


    Thanks in advance.

    Sameer V.
    Friday, October 14, 2011 10:22 AM
  • Sameer,

    Yes it is possible to write a flow document viewer for WinRT. I have already done it for Silverlight, and will port that code to WinRT at some stage.  However my viewer is written specifically for my requirements, so only minimally supports things like floating sections.

    It is a bit ridiculous that there is no proper flow document viewer available, because the RTF control doesn't even read the same content as the WPF flow document viewer making it somewhat useless if you have existing content.


    Thursday, March 8, 2012 9:37 PM
  • @Stefan, you are absolutely right. It is ridiculous winRT (and Silverlight) does not support the Document api (XPS and FlowDocuments) from WPF, which MSFT was pushing as de facto document formats just 4 years ago. We are expected to take bets on new and shiny toys MSFT throws at us, so they can make then redundant and move on to something else.

    Any ways, I'm glad you intend to port FlowDocument to winRT, hopefully you will make it easy for others to use your it! If you need any help please don't hesitate to ask.


    Sameer V.

    • Edited by Sameer.V Friday, March 9, 2012 4:10 PM
    Friday, March 9, 2012 4:10 PM
  • @Sameer,

    Just FYI, I have ported my flow document viewer to WinRT. There are quite serious problems with being able to find out the size of the content as I have described here:


    So my current thinking is more modelled around loading the flow document and then converting it into the RichTextBlock format.   Unlike WPF, there are no implicit styles (http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/f36e2011-4400-4d84-893e-e8581c40016a), so that's going to be a complete pain.

    In my case my content is pretty much text only with hyperlinks and lists.  as we know, hyperlinks are not supported currently. I really hope they will change that before RTM.  And in the case of lists, I'll just have to hack it into an ugly paragraph with no indents.

    I do have another situation, where I'm using figures , but I'm just going to pull out the figure and manually place it on the left.

    if I go ahead with this model, I will probably create a flow document page viewer that does the automated column sizing and zooming et cetera.

    Basically, it's a big mess and handled very disappointingly. WPF was just so perfectly done in this regard.  Here there has been no attempt whatsoever to have backward compatibility with the existing content that we have developed, in a format that Microsoft was encouraging us to use just three or four years ago.


    Wednesday, May 2, 2012 9:07 PM
  • @Stefan

    First off my apologies for not replying sooner :-)

    I completely agree with all your assertions, it is a shame that Microsoft has abandoned FlowDocuments, in my opinion these could be possible reasons...

    1. Windows team has too much on their plate and they don't necessarily care about niche technologies which are not broadly used. 
    2. As METRO apps call into WinRT api, which also support HTML/JS, rendering engine is same across XAML and HTML, building support for FlowDocuments would mean big investments!
    3. I think there are some serious issues with the text rendering in METRO apps, text look really bad as METRO uses Grey scale sub-pixel rendering instead of clear type. This is probably done for security reasons (I believe ClearType rendering happens in the kernel for performance reasons hence it's a possible attack surface). Long story short, without high quality text FlowDocuments will look naff regardless!

    I think your approach is correct in converting FlowDocument in XAML wrapped around in RichTextBlock, I'm looking at similar solution too, trouble is my app relies heavily on images and media and uses implicit styles, annotations etc.. I'm going to have to dumb down the initial version of the app and wait for MSFT to add missing features.

    From time to time I do think about creating equivalent for FlowDocument in winRT, recently I came across http://sdf.codeplex.com/ which is WPF library to replace FlowDocuments with custom document format but still use DocumentViewers built into WPF. This could be an interesting approach, using ItemsControl instead of FlowDocumentScrollViewer



    Sameer V.

    Wednesday, May 23, 2012 10:01 AM
  • Hi All,

    I want to display the contents which is having images and text. e.g. maths question. For this scenario, i have choosen richtextblock to render the content. But the i dont find baselinealignment to make the vertical line alignment as center. How can we achieve that?, i want image and text in one line and it should be vertically center.

    Please help me.............

                        <Paragraph Foreground="Black">
                                <Image Stretch="None" Source="/DataPackets/Media/Thumbnails/100016.jpg"/>
                            <Run Text="Adhikesh"/>

    • Edited by Adhikesh Friday, June 29, 2012 7:07 AM
    Friday, June 29, 2012 6:57 AM