This question is locked. New answers and comments are not allowed.
Hi
I want to add the ability the insert a characted via the RadRichTextBox context menu.
I have created a custom ContextMenuContentBuilder like so:
and attached it to the RadRichTextBox (this.Title) like so:
This opens up the RadInsertSymbolDialog but when I click a symbol on the RadInsertSymbolDialog I get an error.
"Message: System.NullReferenceException: Object reference not set to an instance of an object"
I have just upgraded to the late version of the Telerik controls.
Can you let me know what I am doing wrong.
Many Thanks
I want to add the ability the insert a characted via the RadRichTextBox context menu.
I have created a custom ContextMenuContentBuilder like so:
public class CustomRichTextBoxContextMenu : ContextMenuContentBuilder { private RadRichTextBox radRichTextBox; public RadInsertSymbolDialog insertsymboldialog = new RadInsertSymbolDialog(); public CustomRichTextBoxContextMenu(RadRichTextBox radRichTextBox) : base(radRichTextBox) { this.radRichTextBox = radRichTextBox; this.radRichTextBox.InsertSymbolWindow = insertsymboldialog; } protected override ContextMenuGroup CreateTextEditCommands() { RadMenuItem insertCharacter = new RadMenuItem() { Header = "Insert Character" }; insertCharacter.Click += new Telerik.Windows.RadRoutedEventHandler(insertCharacter_Click); ContextMenuGroup customContextMenuGroup = new ContextMenuGroup(); customContextMenuGroup.Add(insertCharacter); return customContextMenuGroup; } private void insertCharacter_Click(object sender, Telerik.Windows.RadRoutedEventArgs e) { insertsymboldialog.ShowDialog(); } }and attached it to the RadRichTextBox (this.Title) like so:
Telerik.Windows.Controls.RichTextBoxUI.ContextMenu contextMenu = (Telerik.Windows.Controls.RichTextBoxUI.ContextMenu)Title.ContextMenu; contextMenu.ContentBuilder = new CustomRichTextBoxContextMenu(this.Title);This opens up the RadInsertSymbolDialog but when I click a symbol on the RadInsertSymbolDialog I get an error.
"Message: System.NullReferenceException: Object reference not set to an instance of an object"
I have just upgraded to the late version of the Telerik controls.
Can you let me know what I am doing wrong.
Many Thanks