如何在Windows Phone 7中创建自定义文本框? [英] How to create custom textbox in windows phone 7?

查看:103
本文介绍了如何在Windows Phone 7中创建自定义文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过创建自定义文本框来处理Sip。

Is it possible to handle the sip by creating the custom textbox.

我想创建一个自定义文本框->创建获取焦点事件->在我的自定义文本框而不是SIP焦点上,我的自定义键盘应该打开。

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.

要求:


  1. 如何创建自定义文本框?

  2. 打开自定义键盘而不是SIP

  3. 在文本字段中获取光标。


推荐答案

SIP的显示由操作系统处理,并且始终位于任何应用程序的可视树的顶部。如果要提供自定义SIP,则需要提供其他输入控件,因为本机SIP的显示与输入控件相关(例如 TextBox PasswordBox 等)。您可能会发现有关创建保加利亚语键盘

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.

要创建自定义的 TextBox ,您可以从 TextBox 本身,但您可能会发现自己与默认实现作斗争,因此您可能只想从 Control 继承。

To create a custom TextBox you could start by inheriting from TextBox itself, but you may find yourself fighting against the default implementation, so you may just want to inherit from Control instead.

要打开自定义SIP而不是默认SIP,您需要将其绑定到自定义TextBox上的一个事件中,这是从Control继承可能使您的生活更轻松的地方之一,因为如果您继承自TextBox,则一旦它获得焦点,就会显示默认的SIP。您可能希望将SIP作为 PhoneApplicationFrame 的ControlTemplate的一部分,以便可以保证它在页面内容之上。

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.

要在自定义TextBox中获得光标,您需要自己处理插入符号的显示,并在用户在自定义SIP上键入内容时对其进行更新。

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.

要完成听起来简单的事情,这是一项艰巨的工作,我怀疑这是为什么现在还没有人这样做的原因:)我绝对建议在官方 WP7开发UserVoice论坛

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

这篇关于如何在Windows Phone 7中创建自定义文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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