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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:59:18+00:00 2026-05-18T02:59:18+00:00

I just started with WPF and would like some advice with the following: I

  • 0

I just started with WPF and would like some advice with the following:

I have a menu that looks like this:

<Menu Name="MenuBar"
    Grid.Row="0"
    HorizontalAlignment="Right"
    Style="{DynamicResource MenuBarStyle}">
    <MenuItem Header="Settings" />
    <MenuItem Header="Help" />
</Menu>

And in my Window.Resources I have this style defined:

<Style x:Key="MenuBarStyle" TargetType="{x:Type Menu}">
    <Setter Property="Background" Value="{x:Null}" />
    <Setter Property="Foreground" Value="White" />
    <Setter Property="FontSize" Value="10" />
</Style>

This works as I expected and intended. However, I would also like to alter the Padding property of each MenuItem within my Menu. What is the best way to do this? My initial thought was to create a separate style and apply it to each MenuItem, but how would that work if my MenuItems were dynamically added (they aren’t going to be, but just out of curiosity)? Is there a way I can target a child MenuItem from within my “MenuStyle” style?

Thanks,

Steve

  • 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-18T02:59:19+00:00Added an answer on May 18, 2026 at 2:59 am

    You could use an “implicit” style (one without a x:Key-attribute) and target it to the MenuItem-type. This style is then chosen implicitly by default for all MenuItems. Put this style in Menu.Resources if you only want it to be used by this Menu, otherwise in Window.Resources where your Menu-style is.

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

Sidebar

Related Questions

Im just getting started on this whole WPF thing, and need to understand some
I have just started with LS and it looks like I will have to
I know it might be silly, I have just started with WPF. I want
Sorry for this, I've just started programming with wpf. I can't seem to figure
I have just started playing with Microsoft's 08/2010 WPF Ribbon release. The basics appear
I just started WPF this morning so this is (hopefully) an easy question to
I'm just getting started with M-V-VM and WPF and having issues understanding some binding
Sorry if this is a noob questions. I just started learning WPF so hopefully
I have just started using WPF forms instead of Windows Forms forms. In a
I just want to raise this question about WPF's User Control. I just started

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.