Xamarin.ios 正在尝试将事件添加到条目元素的.ShouldReturn

Xamarin.ios 正在尝试将事件添加到条目元素的.ShouldReturn,xamarin.ios,monotouch.dialog,Xamarin.ios,Monotouch.dialog,我正在尝试添加一个事件,该事件由Monotouch.Dialog条目元素中的TextFieldShouldReturn触发。我目前正在尝试附加一个事件,如下所示: //create the entry element EntryElement newEntry = new EntryElement(thisQuestion.Text, "tap to type", null); //add should return newEntry.ShouldReturn(addAn

我正在尝试添加一个事件,该事件由Monotouch.Dialog条目元素中的TextFieldShouldReturn触发。我目前正在尝试附加一个事件,如下所示:

   //create the entry element
   EntryElement newEntry = new EntryElement(thisQuestion.Text, "tap to type", null);
   //add should return
   newEntry.ShouldReturn(addAnswerToSurvey(newEntry.Value, thisQuestion.Index));
   //add the entry to the section
   aSection.Add(newEntry);
我在构建时收到一个错误:“MonoTouch.Dialog.EntryElement.ShouldReturn”在类型“MonoTouch.Dialog.EntryElement”(CS0070)之外使用时只能出现在+=或-=的左侧

我听说人们无法从Monotouch.Dialog语句中获取数据,这似乎就是这个错误可能暗示的。所以 是否可以在条目元素上实现文本字段应返回delegate,如果可以,如何实现?如果没有,是否只是因为entry元素包含文本字段而存在?

Eric,您需要使用:


newEntry.ShouldReturn+=()=>{…}

thisQuestion和.text和.Index是我的代码中的自定义字符串。。。