Is there any way to combine or create custom InputScopes for a TextBox on Windows Phone?
I need the auto-correct functionality of the Text InputScope, but I also want the white submit button provided with the Search InputScope (otherwise it isn't intuitive to users how to proceed from the box).
Is there any way to write my own InputScopes so that I can control these features independently? Or is there a way to apply more than one scope for combined functio开发者_Python百科nality?
Here's the code:
This has the button but no auto-correct:
<TextBox x:Name="InputBox" InputScope="Search" AcceptsReturn="False" KeyUp="InputBox_KeyUp"/>
And this had auto-correct but no button:
<TextBox x:Name="InputBox" InputScope="Text" AcceptsReturn="False" KeyUp="InputBox_KeyUp"/>
For the record, I've read this post and I really hope it doesn't come to that.
InputScope="Maps"
will show the keyboard used by the Maps app, which includes both the dictionary and white submit button. The only differences that I can see from the "Text" keyboard is that it doesn't start out with a capital letter and doesn't have a key for emoticons.
In your code-behind, in your Page_Loaded
event (for example), try adding something like this:
var isSearch = new InputScopeName { NameValue = InputScopeNameValue.Search };
var isText = new InputScopeName { NameValue = InputScopeNameValue.Text };
myTextBox.InputScope = new InputScope();
myTextBox.InputScope.Names.Add(isSearch);
myTextBox.InputScope.Names.Add(isText);
This should hopefully give you the dictionary
from the Text
input scope whilst also having a white submit button from the Search
input scope.
精彩评论