Our WPF application contains multiple RadRichTextBox instances. When right clicking in one of the instances I expected the ContextMenu_Showing event to get fired for only the RadRichTextBox control that I right clicked. This is not the case.
The method gets fired for each instance of the RadRichTextBox. As a result, instead of getting one "View Source" context menu item inserted into the context menu, I get one for each RadRichTextBox control.
I am trying to implement the modification of the RadRichTextBox's context menu as indicated at the following link:
http://www.telerik.com/help/wpf/radrichtextbox-features-context-menu.html
I also modified the example as indicated in the following blog to reference the correct ContextMenu:
http://blogs.telerik.com/xamlteam/posts/10-11-17/customizing-radrichtextbox-s-contextmenu-and-selectionminitoolbar.aspx
In the Telerik public constructor I have the following code:
Telerik.Windows.Controls.RichTextBoxUI.ContextMenu contextMenu =
(Telerik.Windows.Controls.RichTextBoxUI.ContextMenu)this.radRichTextBox.ContextMenu;
contextMenu.Showing += this.ContextMenu_Showing;
I also have the following methods:
private void ContextMenu_Showing(object sender, Telerik.Windows.Controls.RichTextBoxUI.Menus.ContextMenuEventArgs e)
{
RadMenuItem makeViewSourceMenuItem = new RadMenuItem()
{
Header = "View Source"
};
makeViewSourceMenuItem.Click += MakeViewSourceMenuItem_Click;
ContextMenuGroup customContextMenuGroup = new ContextMenuGroup();
customContextMenuGroup.Add(makeViewSourceMenuItem);
e.ContextMenuGroupCollection.Add(customContextMenuGroup);
} private void MakeViewSourceMenuItem_Click(object sender, RadRoutedEventArgs e)
{
FrmHtmlSource dialog = new FrmHtmlSource(_originalText);
dialog.ShowDialog();
}
All the examples I have seen involve just one instance of the RadRichTextBox. Is there anything special I need to do to support multiple instances or is this a limitation with the RadRichTextBox control.
The method gets fired for each instance of the RadRichTextBox. As a result, instead of getting one "View Source" context menu item inserted into the context menu, I get one for each RadRichTextBox control.
I am trying to implement the modification of the RadRichTextBox's context menu as indicated at the following link:
http://www.telerik.com/help/wpf/radrichtextbox-features-context-menu.html
I also modified the example as indicated in the following blog to reference the correct ContextMenu:
http://blogs.telerik.com/xamlteam/posts/10-11-17/customizing-radrichtextbox-s-contextmenu-and-selectionminitoolbar.aspx
In the Telerik public constructor I have the following code:
Telerik.Windows.Controls.RichTextBoxUI.ContextMenu contextMenu =
(Telerik.Windows.Controls.RichTextBoxUI.ContextMenu)this.radRichTextBox.ContextMenu;
contextMenu.Showing += this.ContextMenu_Showing;
I also have the following methods:
private void ContextMenu_Showing(object sender, Telerik.Windows.Controls.RichTextBoxUI.Menus.ContextMenuEventArgs e)
{
RadMenuItem makeViewSourceMenuItem = new RadMenuItem()
{
Header = "View Source"
};
makeViewSourceMenuItem.Click += MakeViewSourceMenuItem_Click;
ContextMenuGroup customContextMenuGroup = new ContextMenuGroup();
customContextMenuGroup.Add(makeViewSourceMenuItem);
e.ContextMenuGroupCollection.Add(customContextMenuGroup);
} private void MakeViewSourceMenuItem_Click(object sender, RadRoutedEventArgs e)
{
FrmHtmlSource dialog = new FrmHtmlSource(_originalText);
dialog.ShowDialog();
}
All the examples I have seen involve just one instance of the RadRichTextBox. Is there anything special I need to do to support multiple instances or is this a limitation with the RadRichTextBox control.