-
Notifications
You must be signed in to change notification settings - Fork 703
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
NumberBox: Visual updates #5032
Conversation
Could you please provide screenshots of the changes. |
auto state = L"SpinButtonsCollapsed"; | ||
|
||
if (spinButtonMode == winrt::NumberBoxSpinButtonPlacementMode::Inline) | ||
{ | ||
winrt::VisualStateManager::GoToState(*this, L"SpinButtonsVisible", false); | ||
state = L"SpinButtonsVisible"; | ||
} | ||
else if (spinButtonMode == winrt::NumberBoxSpinButtonPlacementMode::Compact) | ||
{ | ||
winrt::VisualStateManager::GoToState(*this, L"SpinButtonsPopup", false); | ||
state = L"SpinButtonsPopup"; |
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.
Should we use const expr
's for this?
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 never have before, so 🤷
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.
Oh interesting, in other controls, we do that all the time🤔
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.
Yeah - that's up to you. We typically define the state names in the .h file, like
static constexpr std::wstring_view s_scrollBarsSeparatorExpanded{ L"ScrollBarsSeparatorExpanded"sv };
|
||
<VisualStateGroup x:Name="SpinButtonStates"> |
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.
nit: Add empty line here :)
auto state = L"SpinButtonsCollapsed"; | ||
|
||
if (spinButtonMode == winrt::NumberBoxSpinButtonPlacementMode::Inline) | ||
{ | ||
winrt::VisualStateManager::GoToState(*this, L"SpinButtonsVisible", false); | ||
state = L"SpinButtonsVisible"; | ||
} | ||
else if (spinButtonMode == winrt::NumberBoxSpinButtonPlacementMode::Compact) | ||
{ | ||
winrt::VisualStateManager::GoToState(*this, L"SpinButtonsPopup", false); | ||
state = L"SpinButtonsPopup"; | ||
} |
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 could convert this to a lambda and have a constant string, but not sure if that adds more value. @teaP @StephenLPeters thoughts?
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.
Is it expected that I can't reach the inline increase/decrease buttons with keyboard anymore? It jumps to the input eater, however I can't actually use the increase/decrease buttons. Clicking on them works though.
@@ -165,25 +238,40 @@ | |||
</Grid> | |||
</Popup> | |||
|
|||
<Button x:Name="InputEater" |
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.
If you hover over the inline buttons and slowly move to the left, at some point this will eat the hover input and it seems that nothing is receiving the hover. Do we need to size this better?
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 left a 4px border around the buttons, so there is an area where nothing is getting hover between the buttons, but I can trim it on the left side so that there's no dead space there.
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.
There are aso small regions above, below, to the right and between those buttons that have the same effect. We hardly can fix the issue with the area between the split buttons without having two buttons right? I think it is fine right now.
Oops, good catch! I'll fix that. The up/down buttons are not supposed to get keyboard focus either (since you can just use the arrow keys inside numberbox). |
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.
Looks good to me. For @mdtauk, here the screenshots:
Bit surprised that disabled buttons don't receive focus, the workaround with the input eater seems reasonable here even if it's not the fanciest one.
@@ -165,25 +238,40 @@ | |||
</Grid> | |||
</Popup> | |||
|
|||
<Button x:Name="InputEater" |
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.
There are aso small regions above, below, to the right and between those buttons that have the same effect. We hardly can fix the issue with the area between the split buttons without having two buttons right? I think it is fine right now.
Thanks, I wasn't sure if the borders were to be retained or not. Are the hover and pressed backplates full height, or rounded with padding, like the clear and search buttons. Oh also, shouldn't those chevrons be updated to the FluentUI System Icons |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
auto state = L"SpinButtonsCollapsed"; | ||
|
||
if (spinButtonMode == winrt::NumberBoxSpinButtonPlacementMode::Inline) | ||
{ | ||
winrt::VisualStateManager::GoToState(*this, L"SpinButtonsVisible", false); | ||
state = L"SpinButtonsVisible"; | ||
} | ||
else if (spinButtonMode == winrt::NumberBoxSpinButtonPlacementMode::Compact) | ||
{ | ||
winrt::VisualStateManager::GoToState(*this, L"SpinButtonsPopup", false); | ||
state = L"SpinButtonsPopup"; |
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.
Yeah - that's up to you. We typically define the state names in the .h file, like
static constexpr std::wstring_view s_scrollBarsSeparatorExpanded{ L"ScrollBarsSeparatorExpanded"sv };
|
||
<VisualStateGroup x:Name="SpinButtonStates"> |
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.
Should that be 'SpinButtonsStates' since you use 'SpinButtonsXXX' for the states?
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 think one plural is probably enough?
…don't need to worry about which elements have corners anymore.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
The main change here is that the inline spin buttons are hovering above the inner TextBox, so that the TextBox border extends around the entire control. The good news is that corners are now no big deal and we can remove corner-specific code. The bad news is that when the spin buttons are disabled (a likely scenario at least part of the time) we don't want the TextBox taking hover as input, so I created an InputEater button in the template which solves the problem. (I don't love that it's a button; if you have alternate suggestions I'm all ears.)