1
votes

I create style for the MenuItem. When I create my own menu, everything is good. But how can I apply a style to the context menu of TextBox? I mean, the menu (Copy, Cut, Paste, etc.) - I do not want to create new lines, and just change the style.

//My Custom Menu Example
    <UserControl.ContextMenu>
        <ContextMenu Style="{StaticResource ContextMenuStyle}" HasDropShadow="True">
            <MenuItem x:Name="MenuItem1" Header="Open" 
                    Style="{StaticResource ContextMenuItem}">
            </MenuItem>
            <MenuItem x:Name="MenuItem2" Header="Save" 
                     Style="{StaticResource ContextMenuItem}">
            </MenuItem>
            <MenuItem x:Name="MenuItem3" Header="Delete" 
                    Style="{StaticResource ContextMenuItem}">
            </MenuItem>
        </ContextMenu>
    </UserControl.ContextMenu>
1
have your tried <TextBox.ContextMenu> ?eran otzap

1 Answers

0
votes

You will technically have to to do the same thing you did to your UserControl.ContextMenu to the TextBox.ContextMenu.

Look the below link which has exactly the scenario you are asking about with xaml.