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 3226132
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:25:12+00:00 2026-05-17T16:25:12+00:00

I recently changed my XAML in order to gain the capability to right-justify menu

  • 0

I recently changed my XAML in order to gain the capability to right-justify menu items such as setting font sizes in the below graphic:

File  Configure  Help
      +-------------+  +----+
      | Font size > |->|  8 |
      | Speed     > |  | 10 |
      +-------------+  | 12 |
                       +----+

Obviously, based on that graphic, I won’t be moving from a technical role into graphic design anytime soon 🙂 It’s more just to illustrate what I meant.

The original XAML below did not right-justify the values

<MenuItem Header="_Configure">
    <MenuItem Header="_Font size   ">
        <MenuItem Header="_8" Click="menuConfigFontSz8" />
        <MenuItem Header="1_0" Click="menuConfigFontSz10" />
        <MenuItem Header="1_2" Click="menuConfigFontSz12" />
    </MenuItem>
    :
</MenuItem>

Instead, it gave me:

File  Configure  Help
      +-------------+  +----+
      | Font size > |->| 8  |
      | Speed     > |  | 10 |
      +-------------+  | 12 |
                       +----+

So, to get right-justification, I changed it to:

<MenuItem Header="_Configure">
    <MenuItem Header="_Font size   ">
        <MenuItem Click="menuConfigFontSz8">
            <MenuItem.Header>
                <TextBlock HorizontalAlignment="Right">_8</TextBlock>
            </MenuItem.Header>
        </MenuItem>
        <MenuItem Click="menuConfigFontSz10">
            <MenuItem.Header>
                <TextBlock HorizontalAlignment="Right">1_0</TextBlock>
            </MenuItem.Header>
        </MenuItem>
        <MenuItem Click="menuConfigFontSz12">
            <MenuItem.Header>
                <TextBlock HorizontalAlignment="Right">1_2</TextBlock>
            </MenuItem.Header>
        </MenuItem>
    </MenuItem>
    :
</MenuItem>

However, I find I’ve lost the shortcut capability of doing AltC, F, 0 for selecting font size 10 (it’s just the 0 bit that no longer works, the first two bits are still fine).

Instead it gives me the literal text 1_0 in the menu itself rather than allowing me to use 0 as a quick way of selecting the item:

File  Configure  Help
      +-------------+  +-----+
      | Font size > |->|  _8 |
      | Speed     > |  | 1_0 |
      +-------------+  | 1_2 |
                       +-----+

How do I keep the right justification of the menu text but still allow for an accelerator?

  • 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-17T16:25:13+00:00Added an answer on May 17, 2026 at 4:25 pm

    When you add an accelerator to a MenuItem (and Button) WPF automatically adds a TextBlock to your MenuItem, and this probably prevents your code from working. You can see this effect if you take a look at the answer to this question.

    This code solves the problem if you do not have a generic TextBlock style in your resources that overrides the default TextBlock behaviour.

    <MenuItem Header="_Configure"> 
      <MenuItem Header="_Font size"> 
        <MenuItem Click="menuConfigFontSz8" Header="_8" HorizontalAlignment="Right"/>
        <MenuItem Click="menuConfigFontSz10" Header="1_0" HorizontalAlignment="Right"/>
        <MenuItem Click="menuConfigFontSz12" Header="1_2" HorizontalAlignment="Right"/>
    </MenuItem> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently changed my password and have to change my maven settings.xml file to
HI people I recently changed to VIM for coding in C. I'd like to
I have recently changed my web app to create a database connection per command
Not sure if Azure cache has recently changed, however the access keys seem to
I was recently trying to re-install the fos:userbundle and noticed the docs have changed.
I recently changed URLs of my site. Old URL: mysite.com/top/1 New URL: mysite.com/top/page=1 When
I recently changed some of my pages to be displayed via ajax and I
I recently changed my app to use a UINavigationController, I was using a UINavigationBar
I recently changed a For Each loop to a Parallel.ForEach loop. I'm concerned about
Apple has recently changed the portal. Some of the changes are aery good, but

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.