http://www.telerik.com/community/code-library/silverlight/general/binding-the-content-of-radrichtextbox-in-xaml.aspx#1372009
First, I had the same problem reported by the original poster, which is that the control doesn't show at all if the Height and Width are not set in the XAML; setting them explicitly did fix that problem, but now I'm finding that HTML binding simply doesn't work if the rich text control is in a ListBox, while the exact same code works fine if the control is not in a listbox. I can't easily rework my application, so I really need to get this working within the listbox. Please advise ASAP! Thank you.
6 Answers, 1 is accepted
The solution to the problem can also be found in the forum thread you have posted. Namely, a separate data provider has to be defined for every RadRichTextBox. There is also a working demo in one of the posts, which you can refer to, if needed.
In case that does not help in your case, we would appreciate some more information on your implementation.
Iva
the Telerik team
<UserControl.Resources> <telerikHtml:HtmlDataProvider x:Key="htmlDataProvider" RichTextBox="{Binding ElementName=rtb}" Html="{Binding Path=Html, ElementName=UserControl, Mode=TwoWay}"/>I moved this to the resources of the rich text control itself:
</UserControl.Resources>
<telerik:RadRichTextBox.Resources> <telerikHtml:HtmlDataProvider x:Key="htmlDataProvider" RichTextBox="{Binding ElementName=rtb}" Html="{Binding Path=Html, ElementName=UserControl, Mode=TwoWay}"/>
</telerik:RadRichTextBox.Resources>
and that seemed to fix it. To my mind, this is a bug that should be fixed.
We are glad that you have managed to resolve the issue.
As described in our help article, in order to utilize data binding in data templates, the data provider has to be defined in the corresponding RadRichTextBox's Resources. We will consider scheduling your scenario for revision, but I would highly recommend sticking to declaring the provider in the resources of the rich text box.
If you have any other issues, do not hesitate to contact us again.
Iva
the Telerik team
You are right, I am sorry. I was referring to the last example on the page, where RadRichTextBox is in a DataTemplate, as this case is most similar to yours. The main problem is that when RadRichTextBox is in a DataTemplate the binding of the DataProvider to the rich text box is not working, if the DataProvider is declared outside the scope of the DataTemplate. This is simply how XAML works. We will update the article and make sure it is clearer as soon as possible.
Kind regards,Iva
the Telerik team