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

Combining RadRichTextBoxRibbonUI with ViewModel

1 Answer 43 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Lucien
Top achievements
Rank 1
Lucien asked on 22 May 2013, 03:00 AM
Hi all,

In our project we are creating a Rich Text Editor to enable the user to create "Word-like" templates. The editor uses the RadRichTextBoxRibbonUI and RadRichTextBox for most of the commands (for all the nice text formatting functions and so on). However, we have also added our own buttons to the ribbon to - for instance - insert custom "fields". This is a dropdown list button that needs to be populated by using a property on our ViewModel (we are using Caliburn). 
The Ribbon UI has its DataContext pointing to the RichTextBox and all works well for the default functions. However, I am baffled as to how I get my custom buttons bound to properties on my ViewModel and calling methods on that ViewModel to handle its events.

I guess it basically means using two datacontexts or data sources.

How do I do this?

Regards,

Lucien Dol
Wellington, New Zealand

1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 24 May 2013, 03:05 PM
Hello Lucien,

I am not sure if I understand you correctly.

Generally, it is possible to set different data contexts to separate parts of RadRichTextBoxRibbonUI. In case you are trying to set a DataContext to the dropdown in your application, but still execute one of the RichTextBoxCommands, you can bind the command using the element name of the RadRichTextBox in your project:
<telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding  ElementName=radRichTextBox, Path=InsertFieldCommand}" DataContext=...

I hope this helps! If I misunderstood your
requirements please get back to us with more specific details and we will do our best to assist you.
 
Regards,
Petya
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Lucien
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or