在Windows Phone上禁用文本框中的键盘点击 [英] disable the keyboard on textbox tap on windows phone

查看:90
本文介绍了在Windows Phone上禁用文本框中的键盘点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,现在我对Google上的这个主题感到非常沮丧,因为没有人问正确的问题.

okay, so i am now very frustrated about this topic on google, because no one asks the right questions.

我在Windows Phone 8应用程序上有一个文本框.

i have a textbox on my windows phone 8 applications right.

现在,一旦我单击该文本框,就会弹出SIP键盘(我得到的那部分是由操作系统完成的.)

now once i click on that textbox the SIP keyboard pops up(that part i get, it is done by the OS).

现在我想做的是一旦我单击文本框我不想打开SIP,因为它将导航到另一个页面,但是我不能将其设置为按钮,因为用户可以在窗口中编辑信息.文本框,他们从另一页中选择了数据.

now what i want to do is once i click on the textbox i dont want the SIP to open up , cause it will navigate to a another page, but i cant make it a button cause the user can edit the info in the textbox once they chose the data from the other page.

现在Windows Phone文本框上有一个属性可以限制键盘弹出?

now is there a property on windows phone textboxes that will restrict the keyboard from popping up?

并且我不能将其设置为只读,因为它看起来不太好,然后用户将看到该文本框不可编辑.

and i cant make it read-only because that will not look good, and then the user will see the textbox as uneditable.

任何链接,代码或之前的问题将不胜感激!

any links, code , or previous questions will be appreciated!

我也尝试将焦点设置在其他控件上,但是发生得不够快,所以键盘也会弹出!,

I have also tried setting focus on some other control, but it doesn't happen fast enough so keyboard also pops up!,

我没有物理控件,我的控件都是动态的,取决于发送的内容 网络服务:

I have no physical controls, my controls are all dynamic, depends on what is sent through the webservice:

这里是一个样本! :

 else if (field.CtlType == WFCoreLib.DataModels.Generic.FieldAttributes.ControlType.ctFinder)
                        {
                            TextBox txtFindercontent = new TextBox();
                            txtFindercontent.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                            //txtFindercontent.Text = field.FieldDescLoc.ToString();
                            txtFindercontent.SetValue(Grid.ColumnProperty, 1);
                            txtFindercontent.SetValue(Grid.RowProperty, count);
                            txtFindercontent.Width = 220;
                            txtFindercontent.FontSize = 20;
                            txtFindercontent.TextWrapping = TextWrapping.Wrap;
                            txtFindercontent.IsHitTestVisible = true;
                            //txtFindercontent.LostFocus += txtcontent_LostFocus;
                            txtFindercontent.Name = "fndDescription" + count.ToString();
                            txtFindercontent.Tag = field.MaxValue + "," + field.FieldDescLoc + "," + field.IsRequired + "," + count + "," + blockindex + "," + field.FieldID + "," + field.ColumnName + "," + field.FieldCode;
                            txtFindercontent.GotFocus += txtFindercontent_GotFocus;

                            if (field.FieldType == WFCoreLib.DataModels.Generic.FieldAttributes.DataType.dtInteger || field.FieldType == WFCoreLib.DataModels.Generic.FieldAttributes.DataType.dtDouble)
                            {
                                InputScope scope = new InputScope();
                                InputScopeName name = new InputScopeName();

                                name.NameValue = InputScopeNameValue.Number;
                                scope.Names.Add(name);

                                txtFindercontent.InputScope = scope;
                            }

PS:Apple/iPhone文本框具有限制键盘的属性.我希望WP8也能做到

PS: The Apple/iPhone textbox has a property that restricts the keyboard. i hope WP8 has one aswell

致谢

推荐答案

我认为您可以通过简单的逻辑来实现.因此,您要做的是,使用表达式Blend创建一个透明按钮.将该按钮放在文本框上方.绑定按钮的ZIndex属性.每当您导航到页面时,请检查您的文本框是否包含任何值.如果是,则将按钮的ZIndex设置为移到TextBox的后面.如果条件错误,请执行相反的操作.我认为这可以解决您的问题.

I think you can achieve this by a simple logic. So what you want to do is, Create a transparent button using expression blend. Place that button above your textbox. Bind the ZIndex property of your button. Whenever you navigates to the page check your text box contains any values. If yes set the ZIndex of button to move behind the TextBox. If the condition is wrong do the reverse. I think this will solve your issue.

这篇关于在Windows Phone上禁用文本框中的键盘点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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