1

I'm getting the following error using a custom routed event:

The local property "CustomClick" can only be applied to types that are derived from the "ExampleClass".

Here is my ExampleClass:

public class ExampleClass
{
    public static readonly RoutedEvent CustomClickEvent = EventManager.RegisterRoutedEvent("CustomClick", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(ExampleClass));

    public event RoutedEventHandler CustomClick
    {
        add { AddHandler(CustomClickEvent , value); }
        remove { RemoveHandler(CustomClickEvent , value); }
    } 
}

And in the XAML im trying to subscribe to the event as follow:

<Panel local:ExampleClass.CustomClick="OnCustomClicked">
   <local:ExampleClass/>
</Panel>

Edit: everything works in 32 bit, only get the error using 64 bit platform.

Keith Stein
  • 6,235
  • 4
  • 17
  • 36
Vermot
  • 11
  • 2
  • Do you get this error when you run the program, or only in the designer? – Keith Stein Nov 14 '19 at 21:20
  • I was getting a very similar message, but only at design time, not at runtime. I finally fixed it by following the instructions in this answer: https://stackoverflow.com/questions/41730378/the-event-foo-is-not-a-routedevent/41742877#41742877 – Keith Stein Dec 03 '19 at 18:00

0 Answers0