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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:32:25+00:00 2026-05-30T17:32:25+00:00

In a WPF application (C#) I’ve got an instance of ObjectX in a class

  • 0

In a WPF application (C#) I’ve got an instance of ObjectX in a class ClassA. This ClassA is instantiated in ClassB.

Hence ClassB -> contains instance of -> ClassA -> which contains an instance of -> ObjectX

ObjectX raises an EventA. I need to handle this event in ClassB.

What is this concept called (Event Delegation, Event Routing, …)? And how can it be done?

  • 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-30T17:32:27+00:00Added an answer on May 30, 2026 at 5:32 pm

    In WPF it is called Routed events, but this will work only if both of these are true:

    1. We’re speaking about element classes and ‘contains’ means that one of your control actually contain another [and LogicalTreeHelper states that your controls are parents/children to each other.
    2. If the event you’re looking for is defined as routed with correct routing strategy – either tunelled or bubbling will work. If it is not then routing events won’t help you.

    I have a feeling that all you need is something like this:

    in class B:

    this.instanceOfA.InstanceOfX.MyEvent += MyHandlerInClassB;
    

    but this has nothing to do with WPF.


    UPD: or something like this if you don’t want to make instanceOfX accessible:

    1. Define the same event on classA and raise it whenever instanceOfX raises its event
    2. In ClassB handle instanceOfA.MyEvent

    In this case you may keep instanceOfX private but you’ll have to add one more event in the middle.

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

Sidebar

Related Questions

I have a wpf application. In the window i have a TextBlock which contains
I have a simple WPF application which I am trying to start. I am
My WPF application consists of a main window with a tab control which has
I have a small WPF application in which I have a list of files.
I have a small WPF application. This application has a button that when clicked,
I have an WPF application which has a local rdlc report which show receipt
I created a wpf application which have a single window which is getting started
WPF application, uses a Window dialog to enter PIN. Normally, it looks like this:
My WPF application menus fail to work with Dragon Natually Speaking, and hence I
In WPF application I have MainWindow : Window which loads a POSView : UserControl

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.