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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:57:06+00:00 2026-05-11T23:57:06+00:00

Is there a way for a parent MenuItem to be notified when a child

  • 0

Is there a way for a parent MenuItem to be notified when a child MenuItem is pressed.
For example, I you have

<MenuItem Name='a'>
    <MenuItem Name='b' Header='...'/>
</MenuItem>

how can I add an event handler to a to be notified when b is clicked.
Ideally, the Click event would be either a tunnel or bubble event but this is not the case.
The solution I have in mind is to listen to the Click event on b and forward it to a but this seems pretty heavy handed.
Is there a better solution?

  • 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-11T23:57:06+00:00Added an answer on May 11, 2026 at 11:57 pm

    MenuItem.Click is a routed event (it bubbles up), so you can just subscribe to it on the first MenuItem and be notified of all children at the same time.

    XAML:

    <MenuItem Name='a' Click='OnMenuItemClicked'>
        <MenuItem Name='b' Header='...' />
    </MenuItem>
    

    C#:

    private void OnMenuItemClicked(object sender, RoutedEventArgs e)
    {
        MenuItem item = e.OriginalSource as MenuItem;
        if(null != item)
        {
            // Handle the menu item click here
        }
    }
    

    The trick is to use RoutedEventArgs.OriginalSource, rather than sender. This points to the control that originally fired the event.

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

Sidebar

Related Questions

Is there a way how modules can listen to parent application event? My current
Is there a way where I can have a parent JTable sort value be
Is there any way that parent tag styles do not apply to child tag
Is there a way to update only the parent UpdatePanel without updating the child
Is there any way to know the parent/component which initiates context menu? I have
Is there a way to disable the parent windows buttons? I have a working
Is there a way to add a parent tag to an existing set of
Is there a way to tell parent branch in subversion? I have two branches
Is there any way I can tell Jackson to ignore properties from parent class
Is there a way to only load child nodes when the parent node is

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.