尝试在条目元素上向 .ShouldReturn 添加事件 [英] Trying to add event to .ShouldReturn on an Entry Element

查看:19
本文介绍了尝试在条目元素上向 .ShouldReturn 添加事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加一个由 Monotouch.Dialog 条目元素内的 TextFieldShouldReturn 触发的事件.我目前正在尝试附加这样的事件:

I am trying to add an event that's triggered by the TextFieldShouldReturn inside a Monotouch.Dialog entry element. I am currently trying to attach an event like so:

   //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) 之外使用时

I get an error back on build: 'MonoTouch.Dialog.EntryElement.ShouldReturn' can only appear on the left hand side of += or -= when used outside of the type 'MonoTouch.Dialog.EntryElement' (CS0070)

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

I have heard of people not being able to get data out of Monotouch.Dialog statements, and that's seems to be what this error might suggest. So... Is is possible to implement the text field should return delegate on an entry element, if so, how? If not, is it just there because the entry element contains a text field?

推荐答案

Eric,你需要使用:

Eric, you need to use:

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

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

这篇关于尝试在条目元素上向 .ShouldReturn 添加事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆