Reputation: 158331
I am creating a special search text box. Among other things it have these two events:
[Category("Behavior")]
public event EventHandler<GenericEventArgs<string>> Search;
[Category("Property Changed")]
public event EventHandler<EventArgs> ActiveColorChanged;
[Category("Property Changed")]
public event EventHandler<EventArgs> InactiveColorChanged;
Thing is that only the bottom two shows up in the design view property event explorer thingy (whatever it's name is...). And I am wondering why. Is it because I am not using the standard EventArgs
? That shouldn't be the case though, cause I mean, there are other events not using that... like the key press related events, etc...
The GenericEventArgs<T>
class looks like this:
public class GenericEventArgs<T> : EventArgs
{
public T Value { get; private set; }
public GenericEventArgs() : this(default(T)) { }
public GenericEventArgs(T value) { Value = value; }
}
What am I doing wrong here?
Upvotes: 3
Views: 4072
Reputation: 161831
I suspect that the Property Grid does not support your double-generic EventHandler class. Try this:
public delegate void GenericHandler<T>(object sender, GenericEventArgs<T> e);
If that doesn't work, try a completely non-generic handler, if only to see if that's where the problem is.
If this is the problem, then I suggest you create a bug report about it on Connect, then post the URL to the bug here so we can vote on it.
Upvotes: 5