-
Notifications
You must be signed in to change notification settings - Fork 118
Orientation option for Segmented #747
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
base: main
Are you sure you want to change the base?
Orientation option for Segmented #747
Conversation
24309cb to
4d35ca1
Compare
|
@niels9001 was there a reason the indicator was centered under the content only vs. the entire content? That'll only matter in Icon + Text Horizontal mode. |
|
@Avid29 this works perfect! Just slotted right into my VSM with changing the orientation and I was done! 🦙❤️ I'll take a look through the code itself in a bit. |
michael-hawker
left a comment
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 pretty clean to me. @niels9001 @Arlodotexe let me know your thoughts.
| var container = ContainerFromIndex(i) as SegmentedItem; | ||
| if (container is null) | ||
| continue; | ||
|
|
||
| container.UpdateOrientation(Orientation); |
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.
| var container = ContainerFromIndex(i) as SegmentedItem; | |
| if (container is null) | |
| continue; | |
| container.UpdateOrientation(Orientation); | |
| if (ContainerFromIndex(i) is SegmentedItem item) | |
| { | |
| item.UpdateOrientation(Orientation); | |
| } |
Would this be simpler?
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. I have a tendency to over user guard checks...
| using Windows.Media.Devices; | ||
|
|
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.
Accidental namespace add?
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. Visual Studio really just adds whatever as I type and I often forget to even check 🤷
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, I wonder if it's better in VS 2026, I'll have to see as I use it more. It's definitely been a bigger problem in the last year or so than it was in the past.
| RegisterPropertyChangedCallback(SelectedIndexProperty, OnSelectedIndexChanged); | ||
| RegisterPropertyChangedCallback(OrientationProperty, OnSelectedIndexChanged); |
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.
Would it make sense to extract the logic in OnSelectedIndexChanged into a SaveInitialIndex method then call it from OnSelectedIndexChanged and OnOrientationChanged?
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, wait a minute. That's supposed to call OnOrientationChanged... Yet it does work. Why is that?
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, I see. Because I moved the callback to the DependencyProperty declaration. This line is entirely unnecessary.
Co-authored-by: Andrew KeepCoding <andrewkeepcoding@gmail.com>




Fixes #746
PR Type
What kind of change does this PR introduce?
What is the current behavior?
There is not orientation options for the Segmented control
What is the new behavior?
Add customization options for a vertical Segmented control
PR Checklist
Please check if your PR fulfills the following requirements:
Other information