-
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 56 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 |
---|---|---|
|
@@ -14,5 +14,7 @@ public sealed partial class PrototypePager : Control | |
public ComboBox ComboBoxDisplayTestHook; | ||
public ItemsRepeater NumberPanelDisplayTestHook; | ||
public Rectangle NumberPanelCurrentPageIdentifierTestHook; | ||
|
||
public int AutoDisplayModeNumberOfPagesThresholdTestHook; | ||
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 looks like your test app doesn't use this expect to show the value. In a production environment these are not free and I think we should avoid them if they aren't useful. For the production version of this I would just hard code the value in the test app. 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've removed it! |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,10 +33,11 @@ public enum ButtonVisibilityMode { Auto, AlwaysVisible, HiddenOnEdge, None, } | |
private ItemsRepeater PagerNumberPanel; | ||
private Rectangle NumberPanelCurrentPageIdentifier; | ||
|
||
private static int AutoDisplayModeNumberOfPagesThreshold = 10; // This integer determines when to switch between NumberBoxDisplayMode and ComboBoxDisplayMode | ||
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. Just putting this out as a thought: Should we make this customizable? Of course not in this PR, but maybe this is something we could think about for the future. 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 don't think this adds very much, if you want to customize this you could just change your display mode from combo box to numberbox at your chosen threshold, which doesn't seem like an issue. 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. Fair point, though with that argument you could also argue why we need this in the first place given that devs can implement it themselves. But yeah, it probably doesn't add much to the API. 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. But this gets us the default behavior that our designers think is best. If another app's designer wants a different behavior they can change that but if they want to default to our design this does that for them In reply to: 483778517 [](ancestors = 483778517) 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. Oh yes, that's a very good point. That ensures that app's all use the recommended behavior if they aren't actively trying to work around that. This shouldn't be customizable then. |
||
private static int MaxNumberOfElementsInRepeater = 7; | ||
private static int NumberPanelMiddleStateStartIndex = 5; | ||
private int NumberPanelEndStateStartIndex; | ||
|
||
private static IconElement LeftEllipse = new SymbolIcon(Symbol.More); | ||
private static IconElement RightEllipse = new SymbolIcon(Symbol.More); | ||
|
||
|
@@ -111,6 +112,7 @@ protected override void OnApplyTemplate() | |
ComboBoxDisplayTestHook = PagerComboBox; | ||
NumberPanelDisplayTestHook = PagerNumberPanel; | ||
NumberPanelCurrentPageIdentifierTestHook = NumberPanelCurrentPageIdentifier; | ||
AutoDisplayModeNumberOfPagesThresholdTestHook = AutoDisplayModeNumberOfPagesThreshold; | ||
|
||
// Attach click events | ||
if (FirstPageButton != null) | ||
|
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