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

  • Home
  • SEARCH
  • 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 883789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:39:00+00:00 2026-05-15T12:39:00+00:00

I have two controls A and B. Control B is placed over A. When

  • 0

I have two controls A and B. Control B is placed over A. When B is clicked only it’s clicked event is fired, however I need the click event of A to fire too. Can this somehow be realized using routed events?

Here’s a screenshot of the controls:

alt text http://www.imagebanana.com/img/hu5znv4/buttons.png

Of course this case is just a reduced example, I’m looking for a general way to raise events on all controls below the mouse cursor / at one location. Hoewever, a concrete solution to this problem would help me too! Thank you very much for any hint!

  • 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-15T12:39:01+00:00Added an answer on May 15, 2026 at 12:39 pm

    This can happen if the event handler of the inner control sets the e.Handled property to true. This would prevent the routed event from bubbling any further. But I just checked and I do not see that behavior in WPF 4.

    If e.Handled is preventing your event, what you can do however is use the UIElement.AddHandler overload that takes a boolean handledEventsToo parameter to hook up your click event. This has to be done in code, not markup. Then you should receive the Click event in the outer control and the e.Handled property will already be set to true.

    The following code does set the background of both buttons when I click the inner button.

    <Grid>
        <Button VerticalAlignment="Center" HorizontalAlignment="Center" Click="Click1">
            <Button Width="100" Height="25" Margin="20" Click="Click2" />
        </Button>
    </Grid>
    

    Code Behind

    private void Click1( object sender, RoutedEventArgs e )
    {
        ( (Button)sender ).Background = new SolidColorBrush( Colors.Blue );
    }
    
    private void Click2( object sender, RoutedEventArgs e )
    {
        ( (Button)sender ).Background = new SolidColorBrush( Colors.Red );
        //e.Handled = true; // uncomment to stop bubbling
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, I have no control over the database structure, etc. I need
I have made a control library and two user controls. userControl_1 contains a Panel
I have two controls whos code are run time rendered as below: ctl00_PlaceHolderMain_SPWebPartManager_g_3c1ba10a_23ec_4ab5_b303_18f8bd7ee7e7_ctl00_gdvItinerary_ctl03_txtTravelDate ctl00_PlaceHolderMain_SPWebPartManager_g_3c1ba10a_23ec_4ab5_b303_18f8bd7ee7e7_ctl00_gdvItinerary_ctl04_txtTravelDate
I have two controls on a page, one is a search entry and submission
Let's say you have two Control s, Alice and Bob, and you want to
In Winforms you can have two controls tied to the same datasource in a
What I am trying to achieve is to have two control modes, a free
I have two UIDatePicker controls in my app, one configured with UIDatePickerModeDate and one
I have two User Controls already created now I want to use one as
I have two user controls, in one of them I have a textbox, i

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.