How to add custom menu items to EditControl Embedded ContextMenu?
EditControl has default embedded ContextMenu. This ContextMenu also supports adding custom ContextMenuItem. Here, we have added a custom context menu item, following code demonstrates the same.
Code Example: [Xaml]
<Window.Resources>
<ContextMenu x:Key="contextmenu">
<MenuItem Header="Undo" Command="{x:Static syncfusion:EditCommands.Undo}"
CommandTarget="{Binding RelativeSource={RelativeSource AncestorType={x:Type
syncfusion:EditControl}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Syncfusion.Edit.Wpf;component/Resources/Undo.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Redo" Command="{x:Static syncfusion:EditCommands.Redo}" CommandTarget="{Binding
RelativeSource={RelativeSource AncestorType={x:Type syncfusion:EditControl}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Syncfusion.Edit.Wpf;component/Resources/Redo.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Cut" Command="{x:Static syncfusion:EditCommands.Cut}" CommandTarget="{Binding
RelativeSource={RelativeSource AncestorType={x:Type syncfusion:EditControl}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Syncfusion.Edit.Wpf;component/Resources/Cut.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Copy" Command="{x:Static syncfusion:EditCommands.Copy}" CommandTarget="{Binding
RelativeSource={RelativeSource AncestorType={x:Type syncfusion:EditControl}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Syncfusion.Edit.Wpf;component/Resources/Copy.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Paste" Command="{x:Static syncfusion:EditCommands.Paste}" CommandTarget="{Binding
RelativeSource={RelativeSource AncestorType={x:Type syncfusion:EditControl}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Syncfusion.Edit.Wpf;component/Resources/Paste.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="SelectAll" Command="{x:Static syncfusion:EditCommands.SelectAll}"
CommandTarget="{Binding RelativeSource={RelativeSource AncestorType={x:Type
syncfusion:EditControl}}}">
</MenuItem>
<MenuItem Header="Outlining">
<MenuItem Header="ExpandallText}" Command="{x:Static syncfusion:EditCommands.ExpandAll}"
CommandTarget="{Binding RelativeSource={RelativeSource AncestorType={x:Type
syncfusion:EditControl}}}">
</MenuItem>
<MenuItem Header="Collapseall" Command="{x:Static syncfusion:EditCommands.CollapseAll}"
CommandTarget="{Binding RelativeSource={RelativeSource AncestorType={x:Type
syncfusion:EditControl}}}">
</MenuItem>
</MenuItem>
<!-- Add Custom Context Menu -->
<MenuItem Header="Go To Definition"/>
<MenuItem Header="Find All References"/>
<MenuItem Header="Break Point"/>
<MenuItem Header="View Hierarchy"/>
<MenuItem Header="Increaseindent" Command="{x:Static syncfusion:EditCommands.IncreaseIndent}"
CommandTarget="{Binding RelativeSource={RelativeSource AncestorType={x:Type
syncfusion:EditControl}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Syncfusion.Edit.Wpf;component/Resources/IncreaseIndent.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Decreaseindent" Command="{x:Static syncfusion:EditCommands.DecreaseIndent}"
CommandTarget="{Binding RelativeSource={RelativeSource AncestorType={x:Type
syncfusion:EditControl}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Syncfusion.Edit.Wpf;component/Resources/DecreaseIndent.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Commentlines" Command="{x:Static syncfusion:EditCommands.CommentSelection}"
CommandTarget="{Binding RelativeSource={RelativeSource AncestorType={x:Type
syncfusion:EditControl}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Syncfusion.Edit.Wpf;component/Resources/Comment.png"
MaxHeight="16" MaxWidth="16" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Uncommentlines" Command="{x:Static syncfusion:EditCommands.UncommentSelection}"
CommandTarget="{Binding RelativeSource={RelativeSource AncestorType={x:Type
syncfusion:EditControl}}}">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Syncfusion.Edit.Wpf;component/Resources/Uncomment.png"
MaxHeight="16" MaxWidth="16" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</Window.Resources>
<!-- EditControl -->
<syncfusion:EditControl ContextMenu="{StaticResource contextmenu}" Name="editText"
Background="White" BorderBrush="Black" FontFamily="Verdana" FontSize="14" Foreground="Black"
IsReadOnly="False"
ShowDefaultContextMenu="False" >
</syncfusion:EditControl>
Screenshot

Figure: Default ContextMenu.

Figure: After Adding Custom ContextMenuItem.
Sample