Example of Context menu in WPF

December 16, 2015 0 Comments

Context Menu Introduction:
Context menu means a window appear when we click on right button of mouse on selected Text. Today, we will design context menu with the help of WPF. Here, we will take a Input control with context menu also context menu contain MenuItem.

        <RichTextBox >
                    <MenuItem Command="Cut">
                            <Image Source="apple.png"/>
                    <MenuItem Command="Copy">
                            <Image Source="grapes.png"/>

Suppose, your richTextBox is disabled and you want to show context menu on disabled item then use this code:

<RichTextBox IsEnabled="False" ContextMenuService.ShowOnDisabled="True">

Jacob Lefore

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google