WinUI-Gallery
WinUI-Gallery copied to clipboard
Add adjustable slider properties in the slider example
Description
Make the example2 in Sliders Page manually adjustable.
Motivation and Context
I was tinkering with sliders in my own project and got some exceptions. Then I checked the slider examples but found the example doesn't provide manual settings for manipulating the slider properties, so I decide to add them.
How Has This Been Tested?
Manually test on the GUI.
Screenshots (if appropriate):
from this
to this

Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Now using ControlExample.Options.

Indeed using binding seems simpler and it doesn't seems to throw exceptions even with exceptional inputs, like minimum greater than maximum. Would dive in more.
Thank you @HO-COOH for implementing this! This is a great idea. Also, thank you @chingucoding for providing feedback. I'll have a deeper look at this PR later today before merging it 😄
Thanks a lot @HO-COOH and @chingucoding! This is great. I've added the "Minimum" property to the StepFrequencyValue NumberBox to prevent crashes when set to 0. While I was looking at the slider page, I've also slightly modified the sample underneath to snap to the tick marks.
Before I merge your changes, I have a question regarding the "LargeChange" property. I can't manage to make it work on my end (clicking on the slider moves the thumb to the area where I clicked. I expected it to move by the "LargeChange" value instead). Let me know if you are experiencing the same thing or not.
I'm also experiencing this @gregwoo-microsoft. However I'm not sure what the purpose of LargeChange is and how it is supposed to work since I didn't find any documentation on this. My guess would be that this exists for UIA purposes and make navigation that way easier.
@chingucoding I agree that the documentation is not clear on this. I'll see what I can do to update it.
Based on what I found online (https://wpf.2000things.com/2014/03/10/1025-small-and-large-changes-to-the-value-of-a-slider/) the LargeChange property is supposed to indicate how much a slider should move when clicking on either side of the thumb. Right now when you click on either side, the thumb jumps to that location instead of being incremented by the LargeChange value.
I think that it would be best to remove the "Small Change" and "LargeChange" knobs from this PR. I am afraid that it may cause more harm than good by creating a lot of confusion. What do you think?
I see, that makes sense, thank you for help @gregwoo-microsoft ! It kind of makes sense to remove it since it can be confusing, however on the other hand, there isn't really much left from the API if we remove the small and large change inputs.
@stmoy what are your thoughts on this?
this looks like a bad merge, @ho-cooh would you mind fixing taking a look? :)
@chingucoding What's the problem?
@gregwoo-microsoft What are your thoughts, can we merge this?