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

RadRichTextBox will not display in a ListBox

6 Answers 116 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.
Josh
Top achievements
Rank 1
Josh asked on 10 Jan 2011, 04:49 PM
I've run into what appears to be a bad layout bug in the control: if I put the control in a listbox template, it simply doesn't render unless I set the Height and Width explicitly. 

To be precise, I made a custom UserControl containing a ribbon control and a rich text control (because I use this combination together in many places).  If I place this user control on a page, it works fine.  If I put it in a listbox template and specify the Height and Width, it works fine.  But if I rely on the Silverlight layout, I just see a piece of the ApplicationMenu, and none of the rest of the toolbar or the rich text control.

This is similar to the bug reported here:

http://www.telerik.com/community/code-library/silverlight/general/binding-the-content-of-radrichtextbox-in-xaml.aspx#1373387

Unfortunately, setting the size explicitly isn't really acceptable, because I need to control to flow properly in the application, and I can't find any way to do this with a fixed size.

Please advise.  Thank you.

6 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 12 Jan 2011, 05:50 PM
Hi Josh,

 The matter is lying in the way ListBox measures its children. When the horizontal scroll bar is enabled, it measures all controls in infinite width (allowing them to take as much space as they need), which causes trouble with RadRichTextBox.

If you disable the horizontal scroll bar of the ListBox like this:

<ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled"... />

 it will measure its children in the same width as it is (that is also the case with all other ScrollPanels). That will allow RadRichTextBox to layout the document properly. Also, please note that in this case, the text will wrap inside RadRichTextBox. This should fit your case well.
Let us know if you experience any further problems.

Kind regards,
Iva
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Matthew
Top achievements
Rank 1
answered on 12 Jan 2011, 06:09 PM
I've done this, but it's not a very good workaround, because the listbox is outside the user control that contains the richtextbox, and this violates the encapsulation.  In other words, the layout is like this:

Page
  ListBox
    ListBoxTemplate
       UserControl

And the UserControl contains the richtextbox, along with a ribbon bar and various other tools that make the richtextbox more useful.  But since the person using the Listbox has no idea about this bug in the richtext control, there's nothing to suggest that the listbox shouldn't be allowed to scroll.
0
Iva Toteva
Telerik team
answered on 17 Jan 2011, 06:05 PM
Hi Matthew,

We will allow setting RadRichTextBox's width to Auto in the future, which will allow the control to measure its size properly in containers that measure their children with infinity (ListBoxes in that number).
However, a drawback of using Auto width will be the fact that UI VIrtualization, which is otherwise made use of, will be turned off. This will increase the memory footprint of the application. The performance on the whole will also suffer, because lots of UI elements would have to be created and put in the visual tree at the same time.
If you have any other questions, do not hesitate to contact us again.

Greetings,
Iva
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
legend613
Top achievements
Rank 1
answered on 20 Jan 2011, 06:45 AM
why I can't find RichTextBox when develop Windows Phone7 application?????
0
Iva Toteva
Telerik team
answered on 24 Jan 2011, 04:52 PM
Hi Xu,

RadRichTextBox is included in the RadControls for Silverlight suite and not in the Windows Phone Controls. The rich text box is currently built only against Silverlight 4. The Silverlight for Windows Phone is rather different, which prevents the direct use of the control in a Windows Phone application.
There is a list of the controls included in the Windows Phone suite here.
If you have other questions, do not hesitate to contact us again.

All the best,
Iva
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Robert Bergman
Top achievements
Rank 1
answered on 30 Mar 2011, 07:31 AM
Hi Iva ,

Thanks a ton for the solution. I required so many hours to resolve that issue.


Thanks,
Prashant.
Tags
RichTextBox
Asked by
Josh
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Matthew
Top achievements
Rank 1
legend613
Top achievements
Rank 1
Robert Bergman
Top achievements
Rank 1
Share this question
or