We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

RichTextBox MVVM

Hello,

Is that possible to use th RichTextBoxAdv in a MVVM way ? I mean, I don't want to use code behind to set/get the text inside my RichTextBox I just want to bind to one of his properties.

I tried binding to Document and XAMLText without any success, I looked into the sample but i uses code behind and I don't want that since all my application uses MVVM.

I also found a RichTextBoxAdv.MVVM.WPF lib but I couldn't make it works.

Is there a way to do this in MVVM or do I need to use code behind ?

5 Replies

GT Gunasekaran T Syncfusion Team July 19, 2013 11:09 AM UTC

Hi Jean,

Thank you for your interest in Syncfusion products.

Currently RichTextBoxAdv control does not support binding of XAMLText property directly in Xaml, as a workaround you can achieve this requirement by defining a MVVM extension. We have prepared the WPF sample to illustrate the same to bind the XAMLText property of RichTextBoxAdv control using MVVM framework. Please do find the sample for the same from attachment.

Note: Kindly note that the XAMLText property will not be updated dynamically on content modifications done in RichTextBoxAdv, rather it will be updated only on accessing the XAMLText property (In Getter method). Hence we have used LayoutUpdated event, to get the content modifications done by the user in RichTextBoxAdv control and update the XAMLText to XAMLContent of view model.

Please let us know if you have any other questions.

Regards,
Gunasekaran



Sample_e7f87df0.zip


JM JEAN MICHEL CAMIZON July 25, 2013 08:53 AM UTC

Thank you very much, this works great.

Regards,
Jean Michel


GT Gunasekaran T Syncfusion Team July 25, 2013 12:36 PM UTC

Hi Jean,

Thank you for your update. Please let us know if you require any further assistance.

Regards,
Gunasekaran



CH Chris replied to Gunasekaran T April 9, 2015 03:14 PM UTC

Hi Jean,

Thank you for your interest in Syncfusion products.

Currently RichTextBoxAdv control does not support binding of XAMLText property directly in Xaml, as a workaround you can achieve this requirement by defining a MVVM extension. We have prepared the WPF sample to illustrate the same to bind the XAMLText property of RichTextBoxAdv control using MVVM framework. Please do find the sample for the same from attachment.

Note: Kindly note that the XAMLText property will not be updated dynamically on content modifications done in RichTextBoxAdv, rather it will be updated only on accessing the XAMLText property (In Getter method). Hence we have used LayoutUpdated event, to get the content modifications done by the user in RichTextBoxAdv control and update the XAMLText to XAMLContent of view model.

Please let us know if you have any other questions.

Regards,
Gunasekaran



Sample_e7f87df0.zip

Hello,

Thansk for support. I can't download the sample, could please make it avalaible ?


Thanks



NS Narendran Srinivasan Syncfusion Team April 10, 2015 11:23 AM UTC

Hi Jean

Thanks for your update

We have prepared the WPF sample to illustrate the same to bind the XAMLText property of RichTextBoxAdv control using MVVM framework. Please do find the sample for the same from attachment.

Sample Link
Sample

Please let me know if you have any other questions.

Regards,
Narendran



Loader.
Live Chat Icon For mobile
Up arrow icon