【问题标题】:Trying to add event to .ShouldReturn on an Entry Element尝试将事件添加到条目元素上的 .ShouldReturn
【发布时间】:2012-07-24 15:57:24
【问题描述】:

我正在尝试在 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 语句中获取数据,这似乎是这个错误可能暗示的。所以... 是否有可能实现文本字段应在条目元素上返回委托,如果是这样,如何实现?如果不是,是否只是因为 entry 元素包含一个文本字段?

【问题讨论】:

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

标签: xamarin.ios monotouch.dialog


【解决方案1】:

埃里克,你需要使用:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-08
    • 2013-05-04
    • 1970-01-01
    • 1970-01-01
    • 2019-11-13
    相关资源
    最近更新 更多