Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6212203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:28:24+00:00 2026-05-24T06:28:24+00:00

I have styled my Menu/ContextMenu/MenuItem controls in App.xaml so that those styles apply to

  • 0

I have styled my Menu/ContextMenu/MenuItem controls in App.xaml so that those styles apply to all my app.

defined like this (e.g. with the MenuItem):

<Style TargetType="{x:Type MenuItem}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <!-- more setters -->
</Style>

this is working great.

now, at some point I have a RichTextBox, and I would like its ContextMenu and MenuItems to have a different style.

So I wrote:

<RichTextBox>

    <RichTextBox.ContextMenu>
        <ContextMenu>
            <MenuItem Command="Undo" Style="{StaticResource menuItem}">Toto</MenuItem>
            <MenuItem Command="Redo"/>
            <Separator/>
            <MenuItem Command="Cut"/>
            <MenuItem Command="Copy"/>
            <MenuItem Command="Paste"/>
            <MenuItem Command="SelectAll"/>
        </ContextMenu>
    </RichTextBox.ContextMenu>

    <!-- and here the RichTextBox's conent -->

</RichTextBox>

and now I’m trying to figure out where I can put my new style… Problem is: I can’t figure it out: no matter where and How I add it (static ressource on the RichTextBox, or on The ContextMenu, with an explicit Key or just a targetType), I cannot get rid of my “Global” style. And the local one is just ignored.

how can I proceed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:28:25+00:00Added an answer on May 24, 2026 at 6:28 am

    In the end, I settled for the ContextMenu’s resources, and this even saves me the “Style=…” in every menuItem.

    <RichTextBox.ContextMenu>
        <ContextMenu>
    
            <ContextMenu.Resources>
                <Style TargetType="{x:Type MenuItem}">
                    <Setter Property="SnapsToDevicePixels" Value="true"/>
                    <Setter Property="OverridesDefaultStyle" Value="True"/>
    
                    <Setter Property="Background" Value="{StaticResource MenuItemBackgroundBrush}"/>
                </Style>
            </ContextMenu.Resources>
    
        </ContextMenu>
    </RichTextBox.ContextMenu>
    

    I think I had it from the start, but somehow forgot the OverridesDefaultStyle = true which seemed to be the issue. (though from what I understood of the MS Documentation, it should not have made any difference in my case… I’ll have to try and understand what I missed there)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a menu that looks something like this: <MenuItem x:Name=menu ItemsSource={Binding Items} Style={StaticResource
I have a jquery accordion style menu that I'd like to add some shortcut
My situation is like following. I have a App.xaml which includes Style for ListView
I have a simple horizontal nav menu that uses highly-styled anchors for buttons. Now,
I have an iPad app which has a funky Path-style menu which is present
I have the following markup that is used to produce a pop-up style mega-menu
I have an existing legacy style IDTExtensibility2, IDTCommandTarget Extension that I would like to
I have a context menu situated inside a User Control Resource. <UserControl.Resources> <ContextMenu x:Key=Menu1>
I would like to restyle a ContextMenu , but I have a question about
I have a wordpress menu like this one: <div id=top_menu> <ul class=menu> <li id=menu-item-1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.