-
Notifications
You must be signed in to change notification settings - Fork 678
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
Pager: Add Auto Display Mode functionality #3239
Changes from 55 commits
089f8c0
88cf084
aaac224
6e45803
6cb0cf4
27b8f07
6dbb145
3742723
44908d8
0118bb3
1561e7d
d1d95f0
2c8c8a6
e01dd1a
b31a814
0c5a85b
2e8cfdc
40828c1
f562f14
5aebd68
8216c1b
b210a0d
fadef53
35ee782
9665cea
089c575
a711afa
ac2e16a
ed59b07
11cebd3
a776308
05a8bc7
17cc715
efe037d
e13f307
e5817bc
e1ac9ac
e356d12
f350481
2a04aa2
9700d2d
92b3776
304347f
25aa4e2
e247b68
887e445
a20af66
82d8115
c6c2911
6a053e3
cf87ea4
059b0f4
924e980
8121b28
409172c
4c3312a
b655165
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 |
---|---|---|
|
@@ -529,6 +529,17 @@ public void ChangingDisplayModeTest() | |
|
||
SetNumberPanelDisplayMode(); | ||
VerifyNumberPanelDisplayMode(); | ||
|
||
ChangeNumberOfPages(); | ||
VerifyNumberOfPages("100"); | ||
|
||
SetAutoDisplayMode(); | ||
VerifyAutoDisplayMode(); | ||
|
||
ChangeNumberOfPages(); | ||
VerifyNumberOfPages("5"); | ||
|
||
VerifyAutoDisplayMode(); | ||
} | ||
} | ||
|
||
|
@@ -580,7 +591,7 @@ int GetPreviousPageAsInt() | |
{ | ||
return Convert.ToInt32(GetPreviousPage()); | ||
} | ||
string GetPreviousPage() | ||
string GetPreviousPage() | ||
{ | ||
return elements.GetPreviousPageTextBlock().GetText(); | ||
} | ||
|
@@ -812,6 +823,19 @@ void VerifyDisplayMode(DisplayModes mode) | |
switch (mode) | ||
{ | ||
case DisplayModes.Auto: | ||
if (elements.GetNumberOfPagesTextBlock().GetText() == "100") | ||
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 think it might be better to make this a bit more flexible, e.g. try to convert this to int and check if its higher than lets say 50. 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. Or ideally use the magic const 11 we use in the actual control. |
||
{ | ||
VerifyNumberBoxEnabled(); | ||
VerifyComboBoxDisabled(); | ||
VerifyNumberPanelDisabled(); | ||
} | ||
else | ||
{ | ||
VerifyComboBoxEnabled(); | ||
VerifyNumberBoxDisabled(); | ||
VerifyNumberPanelDisabled(); | ||
} | ||
break; | ||
case DisplayModes.ComboBox: | ||
VerifyComboBoxEnabled(); | ||
VerifyNumberBoxDisabled(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,7 @@ private void OnNumberOfPagesChanged() | |
} | ||
|
||
DisablePageButtonsOnEdge(); | ||
OnPagerDisplayModeChanged(); | ||
} | ||
|
||
private void OnComboBoxSelectionChanged() | ||
|
@@ -113,10 +114,12 @@ private void OnPagerDisplayModeChanged() | |
{ | ||
switch (this.PagerDisplayMode) | ||
{ | ||
case PagerDisplayModes.Auto: | ||
VisualStateManager.GoToState(this, NumberOfPages < 11 ? ComboBoxVisibleVisualState : NumberBoxVisibleVisualState, false); | ||
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. @MarissaMatt The proposal only says something about less than 11 and larger than 11, what about 11 itsself? Is case 11 resulting in NumberBox correct here? I think the spec might need some clarification for this. 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. @chingucoding can you point me to where it talks about the "less than 11 and larger than 11" on the proposal? I can't seem to find any reference to it there. I know the spec mentions it, but I'm interested to see what the proposal mentions. 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. Sure, it is the first paragraph in this section: https://github.com/microsoft/microsoft-ui-xaml-specs/blob/user/savoyschuler/pagercontrol/active/PagerControl/PagerControl.md#creating-a-pager-control It states: "[...] NumberOfPages property is less than 11 and will show the number box mode if it is greater than 11." 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 updated the spec with that requirement but not the proposal so I will make sure they are both matching. The requirement should be if it's 10 pages or less then combo box will be chosen and if it's 10 or more then number box will be chosen. 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 still a little confused.. So should it be: 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 should be if NumberOfPages < 10 then use ComboBox else use NumberBox 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. Great thanks! I'll update the prototype |
||
break; | ||
case PagerDisplayModes.NumberBox: | ||
VisualStateManager.GoToState(this, NumberBoxVisibleVisualState, false); | ||
break; | ||
case PagerDisplayModes.Auto: | ||
case PagerDisplayModes.ComboBox: | ||
VisualStateManager.GoToState(this, ComboBoxVisibleVisualState, false); | ||
break; | ||
|
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 would also verify the boundaries, since the display mode changes at 10 we should be testing 9 and 10 as well.
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.
Done