-
Notifications
You must be signed in to change notification settings - Fork 127
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
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. |
Tested with bits from CommunityToolkit/Windows#747 (needs VSM prop adds still missing from this commit)
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.
Co-authored-by: Andrew KeepCoding <andrewkeepcoding@gmail.com>
|
This is now blocking for #752 |
|
@niels9001 I believe I could get the pill back under the content by finagling the column layout and visual state setters, but as is now I believe it makes the default style's layout more predictable. It might even be simpler if I adjust the default |
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.
This is looking great - and will be really helpful in creating selectable cards or things like a Store-like NavView :)!
Three things that come to mind:
-
Long text labels don't fit.. Maybe we should use texttrimming for this so it just ... for the chars that no longer fit?
-
It feels like we need a bit more spacing vertically (maybe 4 instead of 1) by default to better differentiate what icon belongs to what label. Should we introduce a
HorizontalSegmentedItemSpacingandVerticalSegmentedItemSpacing? -
Have we tested the vertical orientation with the built-in styles too? Could we add an orientation dropdown to this sample too so it's easier to validate any changes in the future?
I looked into it. I'd forgotten that to get the pill to left align properly I had to move it outside of the |
|
Hmm. Yeah, idk what expected behavior is there. You're definitely right that I should add options to more of the samples though. |
bb11f05 to
b2bf5af
Compare
|
Sorry @Avid29 I should have merged maybe for the main update vs. rebase as you're working on this. Wanted to pick up the fixes for the tests to be more reliable for the CI. |
|
No problem 👍 |
|
Held up by #758 |
|
Hopefully CI issues are resolved now. Think there's just a few small comments left and for @niels9001 to approve if the new style changes look good? |
|
Looks like the CI is fine. The issue is just using ref fields in UWP. Hmm... |
niels9001
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.
The visual changes look great to me :)! Thanks a lot @Avid29 !
|
I noticed that the PR adding Orientation support to Segmented has already been merged, but I encountered issues during testing while porting this to the C++ version. In vertical mode, the pill should be positioned on the left, but it is currently rendered below. Because the Orientation property is changed during initialization before the item is added to the container, Item state updates rely on the Orientation property change callback, so dynamically binding the ItemSource may also result in incorrect behavior. This can be reproduced simply by setting the following XAML: <controls:Segmented Orientation="Vertical">
<controls:SegmentedItem Content="Item 1" />
<controls:SegmentedItem Content="Item 2" />
<controls:SegmentedItem Content="Item 3" />
<controls:SegmentedItem Content="Item 4" />
</controls:Segmented>Alternatively, set the default value of Orientation to Vertical in the sample application. |
|
@lgztx96 Good catch! On it. |








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