简体   繁体   English

如何添加用于提交消息的弹出文本框-Windows Phone

[英]How to add a popup textbox for submitting a message - Windows Phone

Shame I have to install another toolkit, but this seems to be pretty useful: Coding4Fun InputPrompt . 遗憾的是,我必须安装另一个工具箱,但这似乎非常有用: Coding4Fun InputPrompt

I am having an issue with it though: There only seems to be functionality for triggering an event when the input is 'completed' without being able to differentiate between whether the tick is tapped or if the cross is tapped. 但是,我遇到了一个问题:似乎只有在输入“完成”时才触发事件的功能,而无法区分是敲击刻度线还是敲击叉号。

Rushed into asking for help unnecessarily there. 赶到那里不必要地寻求帮助。 Found a solution, will post below. 找到解决方案,将在下面发布。


Original question: 原始问题:

Users of my application can currently submit messages which they do by tapping on a textbox and typing in the message and then tapping send. 我的应用程序的用户当前可以通过以下方式提交消息:点击文本框,然后键入消息,然后点击发送。 I want to make this cleaner by not having a permanent textbox for this and instead have users tap on a button on the application bar along the button which brings up the keyboard along with a textbox to type into, and when users tap submit the textbox and keyboard disappear again. 我想通过没有一个永久性的文本框来使其更清洁,而是让用户点击应用程序栏上的按钮,沿着该按钮调出键盘以及要输入的文本框,并在用户点击提交文本框和键盘再次消失。

I can't see any way of creating a popup with a textbox in it, so how would I do this? 我看不到任何创建带有文本框的弹出窗口的方法,那么我该怎么做?

I'm using the WP Toolkit already for a messagebox with a ListPicker inside, by even this toolkit seemingly has no way of adding a textbox. 我已经将WP Toolkit用于带有内部ListPicker的消息框,即使此工具包似乎也无法添加文本框。

I'm not sure what your trying to do is even possible. 我不确定您的尝试甚至可能。 However, what you could do is have a Parent Form which contains your ideal Interface . 但是,您可以做一个包含您理想的InterfaceParent Form Within this Parent you could create an Event Handler that is listening for a response. 在此父级中,您可以创建一个侦听响应的Event Handler程序。

Then when it comes to that Textbox it actually creates a Child Form or Page . 然后,当涉及到该Textbox它实际上会创建一个Child FormPage Which they can input their value into. 他们可以输入自己的价值。 Then the page automatically closes, which then the Event Handler will already know the change for you to manipulate with the rest of your Logic. 然后页面自动关闭,然后Event Handler将已经知道更改,您可以使用其余的逻辑进行操作。

As mentioned above, normally you would go to another page. 如上所述,通常您将转到另一个页面。 I don't know if my solution is viable, but it does accomplish your goal. 我不知道我的解决方案是否可行,但确实可以实现您的目标。 I'd recommend possibly refactoring your interface so that it makes it slightly more elegant. 我建议您可能会重构您的界面,以使其更加优雅。 That way your logic handles it more elegant as well. 这样,您的逻辑也可以更优雅地处理它。

Hope that helps. 希望能有所帮助。

Shame I have to install another toolkit., but this seems to do the trick just fine: Coding4Fun InputPrompt . 遗憾的是,我必须安装另一个工具包。但这似乎可以解决问题: Coding4Fun InputPrompt

They've added input.IsCancelVisible = true to add a cancel button and then use e.PopUpResult.ToString() == "Ok" within the input_completed method to only submit when the tick button is tapped. 他们已经添加了input.IsCancelVisible = true来添加一个取消按钮,然后在input_completed方法内使用e.PopUpResult.ToString() == "Ok"仅在点按了勾号按钮时提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM