c# - Surface sdk 2.0 keyboard not showing in application -
I'm trying to show the keyboard when I click on a button, but it's not showing a keyboard at all. "Test" is printed but the keyboard is not showing. My code is:
Private SurfaceTextBox mySurfaceTextBox = New SurfaceTextBox (); Zero Showcase (Object Sender, Routing Avenger, ARGS E) {// System.winpose.keyboard.focus (Initualization) HotconWebFoot Button (SurfersButtons) Sender); System.Windows.Input.Keyboard.Focus ((IInputElement) mySurfaceTextBox); Console.Write ("Test"); SurfaceKeyboard.IsVisible = true; Surface board. Sintax = (Float) Interactive Surf. Primary SurfSide Bounce With - (Surffeebox Wideth / 2); Surface board Center Y = (float) interactive surface. Primary surface equipment. Bounce HEIGHT - (surface board. HEIGHT / 2); SurfaceKeyboard.Layout = Microsoft.Surface.KeyboardLayout.Alphanumeric; SurfaceKeyboard.Rotation = (Float) (Math.PI / 2); SurfaceKeyboard.ShowsFeedback = false; }
Can anyone help me?
T's know a lot about the surface structure; But generally you can not force the keyboard to display, the focused object needs to accept the input as input.
Because buttons usually do not accept text input, so the focus of the keyboard can not be given to it, and thus
system. Windows Input. Cabard Focus (second dispute element) sender);
will be ignored.
If the only keyboard is the idea of visible, then an option to add SurfaceTextBox
and
XAML
to its XAM file Add to
& lt; Canvas & gt; Focus on the text box (this will remove focus from the button) & lt; S: SurfaceTextBox name = "yourSurfaceTextBox" canvas. Tap = "200" canvas Lift = "200" width = "100" height = "40" /> & Lt; / Canvas & gt;
code file
zero showcase (object sender, routing event e) {console.light ("test"); System.Windows.Input.Keyboard.Focus ((IInputElement) yourSurfaceTextBox); // the rest of your code ...}
If the button is the idea of getting navigation between buttons, then consider using this SurfaceListBox
Because it accepts as a default behavior arrow navigation from the keyboard, then your code should work upwards.
Questions in Questions
How can I test it on a non-surface device? You can use it which can change how the surface can change in the text box in the case of Caesar
, how can it be hidden? I really do not understand what you mean 'touched it', but you can change the cursor position in the text box using the selection method.
yourSurfaceTextBox.Select (position, 0);
To get touch spots you can use
ReadOnlyTouchPointCollection touch = touchTarget.GetState ();
Then you have to find out where the touch was in relation to something, but this question is beyond the scope of the original question.
Is fun!
Comments
Post a Comment