views:

61

answers:

2

HI there,

I have added a static event with the following code:

public class TypeChangedEventArgs : EventArgs
{
     public Types TypeSelected { get; set; }
}

public delegate void TypeChangedHandler(TypeChangedEventArgs eventArgs);

public static event TypeChangedHandler TypeChanged;

And I do get an event handler for TypeChanged, then I typed some code like MessageBox.Show("Hello World") there and tried to compile, then I get the following error:

The property "TypeChanged" does not exists on the type "Selector" in the XML namespace 'clr-namespace:Test'

I am not sure what's missing, can someone help me?

Thanks

A: 

You haven't shown how you're trying to reference the TypeChanged property. Could you show either the XML you're using or the C# code?

Are you perhaps trying to effectively subscribe to the event via an instance of Selector?

Jon Skeet
<local:Selector x:Name="SelectorControl" Grid.Row="1" Grid.Column="2" Size="300" SizeChanged="SelectorControl_SizeChanged" />
PlayKid
+1  A: 

The problem is that your event is static - remove that keyword and it compiles fine.

James Cadd