-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add InputScope Property To NumberBox #3186
Changes from 6 commits
e85c6de
6925710
78922f2
0bbfb6b
31971a3
dbe6fb9
b6e356f
3262fd0
64cbe02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,20 @@ NumberBox::NumberBox() | |
LostFocus({ this, &NumberBox::OnNumberBoxLostFocus }); | ||
|
||
SetDefaultStyleKey(this); | ||
SetDefaultInputScope(); | ||
} | ||
|
||
void NumberBox::SetDefaultInputScope() | ||
{ | ||
// Sets the default value of the InputScope property. | ||
// Note that InputScope is a class that cannot be set to a default value within the IDL. | ||
winrt::InputScopeName inputScopeName = winrt::InputScopeName(winrt::InputScopeNameValue::Number); | ||
winrt::InputScope inputScope = winrt::InputScope(); | ||
inputScope.Names().Append(inputScopeName); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm not that familiar with inputScope, does this mean that you can apply multiple input scopes? like you can have number and currency at the same time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It's certainly an interesting design decision, one which I've never understood myself. However, my assumption has always been it's for the cases where the user can switch the keyboard. It simply limits what keyboards you are allowed to switch between. You might have to reach out to the Windows team to understand the thinking here though. I don't recall ever seeing documented reasons why this is a collection. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MikeHillberg do you happen to know? |
||
|
||
static_cast<NumberBox*>(this)->SetValue(s_InputScopeProperty, ValueHelper<winrt::InputScope>::BoxValueIfNecessary(inputScope)); | ||
|
||
return; | ||
} | ||
|
||
// This was largely copied from Calculator's GetRegionalSettingsAwareDecimalFormatter() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we prefer using auto and const for the local variable types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a problem, should I pursue this now though or wait for potential work-arounds setting in the default style?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just did it now so hopefully we can close this. There is no response on work-arounds for the XAML bugs.