Combining RadRichTextBoxRibbonUI with ViewModel

2 posts, 0 answers
  1. Lucien
    Lucien avatar
    3 posts
    Member since:
    May 2013

    Posted 21 May 2013 Link to this post

    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?


    Lucien Dol
    Wellington, New Zealand
  2. Petya
    Petya avatar
    990 posts

    Posted 24 May 2013 Link to this post

    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.

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top