如何在 Windows Phone 7 中创建自定义文本框?
是否可以通过创建自定义文本框来处理 sip。
我想创建一个自定义文本框 -->创建获得焦点事件-->在我的自定义文本框(而不是 SIP)的焦点上,我的自定义键盘应该打开。
需求:
- 如何创建自定义文本框?
- 打开自定义键盘而不是 SIP
- 将光标置于文本字段中。
Is it possible to handle the sip by creating the custom textbox.
I want to create a custom textbox --> create the got focus event--> On focus of my custom textbox instead of SIP my custom keypad should open.
Requirements:
- How to create custom textbox?
- Open the custom Keypad instead of SIP
- Get the cursor in the textfield.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SIP 的显示由操作系统处理,并且始终位于任何应用程序的可视化树的顶部。如果您想提供自定义 SIP,则需要提供替代输入控件,因为本机 SIP 的显示与输入控件相关(例如
TextBox
、PasswordBox 等)。您可能会找到这篇关于创建保加利亚语键盘 有用。
要创建自定义
TextBox
,您可以从继承TextBox
本身开始,但您可能会发现自己与默认实现作斗争,因此您可能只想继承改为控制。
要打开自定义 SIP 而不是默认 SIP,您需要将其绑定到自定义 TextBox 上的事件中,这是从 Control 继承可能会让您的生活更轻松的地方之一,因为如果您从 TextBox 继承,那么一旦它获得焦点,就会显示默认的 SIP。您可能希望将 SIP 作为
PhoneApplicationFrame
的 ControlTemplate 的一部分,以便保证它位于页面内容之上。要在自定义文本框中显示光标,您需要自己处理插入符号的显示,并在用户在自定义 SIP 上键入时更新它。
要实现听起来简单的事情需要做大量的工作,我怀疑这就是为什么还没有人做到的原因:)我绝对建议在官方 WP7 开发 UserVoice 论坛
The display of the SIP is handled by the operating system and will always be on top of the visual tree of any application. If you want to provide a custom SIP, you will need to provide an alternative input control, because the display of the native SIP is tied to input controls (such as
TextBox
,PasswordBox
, etc.). You may find this article about creating a Bulgarian keyboard useful.To create a custom
TextBox
you could start by inheriting fromTextBox
itself, but you may find yourself fighting against the default implementation, so you may just want to inherit fromControl
instead.To open the custom SIP instead of the default SIP, you'll need to tie this into an event on your custom TextBox and this is one of the places where inheriting from Control will probably make your life easier, because if you inherit from TextBox, then as soon as it receives focus the default SIP will show. You will probably want to make the SIP part of the ControlTemplate for the
PhoneApplicationFrame
so that you can guarantee that it is above the page content.To get a cursor in your custom TextBox you'll need to handle the display of a caret yourself and update it as the user types on your custom SIP.
This is an awful lot of work to achieve something that sounds simple, which I suspect is why noone has done it yet :) I would definitely recommend requesting it as a feature on the official WP7 Dev UserVoice forum