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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:16:39+00:00 2026-06-04T11:16:39+00:00

Below is the constructor and an event handler in my window. public MyWindow() {

  • 0

Below is the constructor and an event handler in my window.

    public MyWindow() {
        InitializeComponent();

        foreach (RoutedEvent routedEvent in EventManager.GetRoutedEvents())
        {
            EventManager.RegisterClassHandler(typeof(TestUnbuggerWindow), routedEvent, OnRoutedEvent, true);
        }
    }

    public void OnRoutedEvent(Object sender, RoutedEventArgs args)
    {
    }

I’m trying to preview all events, as I’m learning WPF and I think this might expose some of what is going on unseen. Anyway, I get the following build error:

Error   1   The best overloaded method match for 'System.Windows.EventManager.RegisterClassHandler(System.Type, System.Windows.RoutedEvent, System.Delegate, bool)' has some invalid arguments
Error   2   Argument 3: cannot convert from 'method group' to 'System.Delegate'

I got the loop to register for all events from this website.

I believe the problem is caused by the method signature not matching something, but I’m unsure. Could someone shed light on this for me?

  • 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-06-04T11:16:41+00:00Added an answer on June 4, 2026 at 11:16 am

    you need to use the handler explicity

    EventManager.RegisterClassHandler(typeof(TestUnbuggerWindow), 
         routedEvent, new RoutedEventHandler(OnRoutedEvent), true);
    

    It is because you the compiler needs to know what type of handler you want and since the signature takes a Delegate type it cannot infer that you want RoutedEventHandler.

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

Sidebar

Related Questions

I wonder if there is something wrong with the copy constructor function below? class
Below I am creating an object in JavaScript. Within the constructor I am setting
In the class below, only the second constructor takes a ForumThread object. Otherwise, it
Why is the Child class's converter constructor called in the code below? I mean,
I have the below prog Object.prototype.inherit = function(baseConstructor) { this.prototype = (baseConstructor.prototype); this.prototype.constructor =
memset is sometimes used to initialize data in a constructor like the example below.
I get the following error with the code below. expected constructor, destructor, or type
Using jQuery 1.7.1, I'm trying to create an event handler for the change event
I've setup (logger class constructor) logging as below- Log() { loggerObj = Logger.getLogger(); //Create
The question In Javascript, how can an event handler function refer to members of

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.