事件未显示在属性网格中
我正在创建一个特殊的搜索文本框。 除此之外,它还有这两个事件:
[Category("Behavior")]
public event EventHandler<GenericEventArgs<string>> Search;
[Category("Property Changed")]
public event EventHandler<EventArgs> ActiveColorChanged;
[Category("Property Changed")]
public event EventHandler<EventArgs> InactiveColorChanged;
事情是,只有底部的两个事件显示在设计视图属性事件资源管理器中(无论它的名称是什么......)。 我想知道为什么。 是因为我没有使用标准 EventArgs
吗? 但情况不应该如此,因为我的意思是,还有其他事件没有使用它...比如按键相关事件等...
GenericEventArgs
类看起来像这样:
public class GenericEventArgs<T> : EventArgs
{
public T Value { get; private set; }
public GenericEventArgs() : this(default(T)) { }
public GenericEventArgs(T value) { Value = value; }
}
我在这里做错了什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑属性网格不支持您的双通用EventHandler类。 试试这个:
如果这不起作用,请尝试一个完全非通用的处理程序,如果只是为了看看问题是否出在哪里。
如果这是问题所在,那么我建议您在 Connect< 上创建有关该问题的错误报告/a>,然后在此处发布该错误的 URL,以便我们对其进行投票。
I suspect that the Property Grid does not support your double-generic EventHandler class. Try this:
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.