How to create custom textbox in windows phone 7?
Is it p开发者_JAVA技巧ossible 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.
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 from TextBox
itself, but you may find yourself fighting against the default implementation, so you may just want to inherit from Control
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
精彩评论