This is a migrated thread and some comments may be shown as answers.

[Solved] Dynamic Document

1 Answer 137 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mark Jakes
Top achievements
Rank 1
Mark Jakes asked on 22 Jul 2011, 02:53 AM
Hello All

I am new to RichTextBox and love the component but I am having difficulty finding out if I can perform the actions described below.  I need some pointers.

We want to create a dynamic document from a database of 'parts' provided by RIA services.

i.e. pseudo code to 'build' document


foreach( DocPart p in context.document.parts)
{
    XAML PartToAdd = p.content.XAML;
    Bool isEditable = (this.user.userlevel == USER_AUTHOR);
    RichTextBox  ... ( AddPart... 
            BookmarkStart(p.id)
            <SomeWrapper "isEditable = {Binding "isEditable}"> 
                PartToAdd  XAML content
            </SomeWrapper>
            BookmarkEnd(p.id)
    );
}

The idea is that the document is readonly, with a context menu to edit the part if the user is an Author.

When the user clicks on the 'part' I want to put a border around or highlight that part only with a context menu available for the user to click if they have rights to edit it.   Inline editing is not essential as the content of that 'part' will be edited in a new window.  Once edited, that part will be pushed back as XAML to the database and the changes should be updated on screen through two-way databinding.

As there are likely to be in excess of 500 of 'parts' or more, is a single RadRichTextBox control going to be efficient enough?  Most of the parts will just contain text with simple formating although a few might contain images.  I thought I could use a virturalisation panel of sorts and have multiple RichTextBox's loading for each part, but from other forum posts, this seems to be an inefficient option.

So, can anyone give me any pointers to get me started to acheive this?   We previously solved this with a RadGridView and data virtualisation, RadGridView is very efficient in this respect, but, once we styled the rows in the grid, because the row heights were vastly different for each part, we were not easily able to 'scroll-into-view' the part just added or editied due to row height averaging. 

I am thinking that RadRichTextBox will overcome this by building the document in the viewmodel before rendering the 'parts'; and then we can move to the part using a bookmark, simulating the 'scroll-into-view'?  Just a thought.  Any ideas from seasoned RichTextBox users welcomed!

Thanks

Mark.

1 Answer, 1 is accepted

Sort by
0
Vesko
Telerik team
answered on 27 Jul 2011, 02:40 PM
Hello Mark Jakes,

RadDocument is designed to be easily created from source code. You can add paragraphs, tables, inlines, bookmarks, etc. which means that you can build a document from parts. About the performance with 500 parts - currently RadRichTextBox behaves reasonably well with around 200 pages of text, so the performance here depends on the size of your parts.
All of the features which you are talking about are doable, however they are not trivial and will require custom coding.

If you have any further questions please do not hesitate to contact us again.

Regards,
Vesko
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
RichTextBox
Asked by
Mark Jakes
Top achievements
Rank 1
Answers by
Vesko
Telerik team
Share this question
or