Reputation: 8704
Is it possible to not show system keyboard, when you tap textbox? Ive created custom keyboard and can work with textblock only, because of this i cant delete just parts of sentence.
Upvotes: 1
Views: 373
Reputation: 2735
If you set IsReadOnly
to true
then the user can still select the text in a TextBox
to copy paste and the OS doesn't show the software input keyboard when selected. You can still alter the contents of the TextBox
through code though. Eg;
<TextBox x:Name="ExampleTextBox"
IsReadOnly="True"
Text="Initial Content"
GotFocus="ExampleTextBox_GotFocus"
/>
And in your code behind;
private void ExampleTextBox_GotFocus(object sender, System.Windows.RoutedEventArgs e) {
ExampleTextBox.Text += " ... focused!";
}
Would prevent the user from entering text via the software keyboard but will append "... focused" everytime they give focus to the TextBox
. Contrived example, but you get the idea.
The only other thing I'd suggest is to re-style the TextBox
. By default when IsReadOnly
is set the TextBox
will provide visual cues that it can't be modified by the user. Which isn't the case here.
Upvotes: 3
Reputation: 3046
if the user touches the keyboard, the keyboard will get focus.
the only option you as a developer have is to catch it and call this.focus moving focus away from textbox.
This will however mean that there will be a flicker where default keyboard pops up and is hidden.
I know this because i have a keyboard app. There is no other way.
Upvotes: 1