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

One Ribbon Two RichTextBoxes

5 Answers 92 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Greg Gum
Top achievements
Rank 1
Greg Gum asked on 13 Jan 2012, 10:52 PM
I have an app which has two rich textboxes.  They are both visible at the same time on a page. At the top, there is a RibbonBar with the usual RTB controls.  I can wire this up to one RTB, and the ribbonview works fine with it.  However, I need it to work with both of the RTB's, as the user could be adding text to either of them.

The binding looks like this:
DataContext="{Binding ElementName=DataFormAlpha, Path=PART_NotesRichTextBox_PerEntity}" 

But I do not see a way to bind to both of the RTB's.

Any suggestions would be appreciated.

Greg

5 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 17 Jan 2012, 06:05 PM
Hi Greg,

RadRichTextBoxRibbonUI can be used with one RadRichTextBox at a time.
What you can do, is to handle the GotFocus event of both RadRichTextBoxes and change the DataContext of the RibbonUI to the Commands property of the focused rich text box like this:

private void radRichTextBox_GotFocus(object sender, RoutedEventArgs e)
{
    this.radRichTextBoxRibbonUI1.DataContext = ((RadRichTextBox)sender).Commands;
}

Regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Michele
Top achievements
Rank 1
answered on 20 Jan 2012, 10:08 AM
Hello Iva,
I've tried the solution you've suggested, using a unique RadRichtextBoxRibbonUI activating its DataContext on the GotFocus event of the both the two RadRichTextBox controls but it happens nothing...
Do the RadRichtextBoxRibbonUI or the various RadRichTextBox controls need some particular declaration o attributes to work as you have suggested?
Please, could you publish a small project showing this behavior?
Thanks a lot.
Michele
0
Iva Toteva
Telerik team
answered on 20 Jan 2012, 08:35 PM
Hi Michele,

Perhaps you have forgotten to remove the binding of the DataContext in XAML.
Anyhow, please find attached the demo you requested. 

All the best,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Michael
Top achievements
Rank 1
answered on 10 Aug 2013, 10:09 PM
Hello,

Would you be able to extend this example with Mail Merge functionality?

I have 2 RadRichTextBoxes with one RadRichtextBoxRibbonUI. I've implemented GotFocus event as you have suggested.  It works great.  Where ever my focus is, I can use ribbon bar items to manipulate it (fonts, colors, etc...).  In addition to this, I am using Mail Merge.  Both richtextboxes are binded to the same list.  If I have focus in RichTextbox 1, then I can iterate through the list, but fields in RichTextBox 2 are not changed (understandable).

Can you suggest how to overwrite MailMerge functions so that I can make changes on both RadRichTextBoxes at the same time?
0
Boby
Telerik team
answered on 14 Aug 2013, 05:59 AM
Hi Michael,
As it seems our are scattered between two forum threads, I would suggest to continue our conversation in the other thread you started on the matter.

Regards,
Boby
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
RichTextBox
Asked by
Greg Gum
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Michele
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Boby
Telerik team
Share this question
or