This question is locked. New answers and comments are not allowed.
I've run in to some strange behaviour when I have two or more RadRichTextBoxes on the screen at the same time while using a custom ContextMenuContentBuilder. When I click on Paste from the context menu of any of the RadRichTextBoxes it pastes in the last one rendered. However if I paste using CTRL+V it works properly. I'm guessing I've implemented something wrong here but can't quite figure out what.
Here is the code:
MainPage.xaml
<Grid x:Name="LayoutRoot" Background="White"> <StackPanel> <telerik:RadRichTextBox Height="100" x:Name="RadRichTextBox1"> </telerik:RadRichTextBox> <telerik:RadRichTextBox Height="100" x:Name="RadRichTextBox2"> </telerik:RadRichTextBox> </StackPanel></Grid>MainPage.xaml.cs
public partial class MainPage : UserControl{ public MainPage() { InitializeComponent(); Loaded += new RoutedEventHandler(MainPage_Loaded); } void MainPage_Loaded(object sender, RoutedEventArgs e) { if (!DesignerProperties.IsInDesignTool) { ContextMenu contextMenu1 = (ContextMenu)RadRichTextBox1.ContextMenu; contextMenu1.ContentBuilder = new TextMenuBuilder(RadRichTextBox1); ContextMenu contextMenu2 = (ContextMenu)RadRichTextBox2.ContextMenu; contextMenu2.ContentBuilder = new TextMenuBuilder(RadRichTextBox2); } }}TextMenuBuilder.cs
public class TextMenuBuilder:ContextMenuContentBuilder{ private RadRichTextBox radRichTextBox; public TextMenuBuilder(RadRichTextBox radRichTextBox) :base(radRichTextBox) { this.radRichTextBox = radRichTextBox; }}By the way, I've taken all of my custom code out of the TextMenuBuilder class in an attempt to isolate the issue - I am planning to add custom menu items to each of the different RadRichTextBoxes.
Thanks,
Anthony
