ContextMenu holds a reference to last RadRichTextBox it's shown for. Since ContextMenu is cached by MEF, this leads to memory leak.
Workaround: There are two options:
- manually set different instances of ContextMenu to all your RadRichTextBox-es
this.radRichTextBox.ContextMenu = new Telerik.Windows.Controls.RichTextBoxUI.ContextMenu();
- Create custom context menu that will be non-sharable. MEF will automatically load different instances of it for all RadRichTextBoxes on demand:
[PartCreationPolicy(CreationPolicy.NonShared)]
[CustomContextMenu]
public class NonSharedContextMenu : ContextMenu
{
}
Using any of the options will prevent MEF from creating cached instance of the ContextMenu.