I'm working on an application that dynamically creates a RadDocument, and then sets the document property of a RichTextBox to the document. (richTextBox.Document = GenerateDocument())
Recently we switched to mvvm. So I didn't have to rewrite all the code, I just create the RadDocument in the ViewModel and expose it as a property. However, I am unable to bind the document to the richtextbox. ('System.WIndows.Data.Binding' cannot be converted to type 'Telerik.WIndows.Documents.Model.RadDocument')
What can I do to fix this without rewriting my code to return html or xaml instead?
public
class
ViewModel
{
private
RadDocuement _Document;
public
RadDocument Document
{
get
{
if
(_Document ==
null
)
_Document = GenerateDocument();
return
_Document;
}
}
private
RadDocuement GenerateDocument()
{
RadDocument doc =
new
RadDocument();
// add sections, paragraphs, etc
return
doc;
}
}
<
telerik:RadRichTextBox
Document
=
"{Binding Path=Report.Document}"
IsReadOnly
=
"True"
/>