disable the keyboard on textbox tap on windows phone

寵の児 提交于 2019-12-25 11:57:27

问题


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

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

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

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.

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!

EDIT: 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:

Here is a sample! :

 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: The Apple/iPhone textbox has a property that restricts the keyboard. i hope WP8 has one aswell

Regards


回答1:


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.



来源:https://stackoverflow.com/questions/18697839/disable-the-keyboard-on-textbox-tap-on-windows-phone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!