我有一个带有一个自定义事件的用户控件。如果重要,这在 Windows Phone 应用程序中。用户控件的 C# 中的事件如下所示:
public delegate void TextChangedVoid(string newText)
public event TextChangedVoid TextChanged;
然后我将它添加到我的 Window 的 XAML 中:
<local:ClientList TextChanged="clist_TextChanged"...
在页面的 C# 中:
private void clist_TextChanged(string newText)
{
...
}
看起来不错,但是每次构建项目时都会出现此错误:
No overload for 'clist_TextChanged' matches delegate 'TextChangedVoid'.
为什么会这样?我应该在我的活动中使用字符串以外的类吗?