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
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
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.
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.
Iva
the Telerik team
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.
Iva
the Telerik team
Thanks a ton for the solution. I required so many hours to resolve that issue.
Thanks,
Prashant.