amwx / FluentAvalonia

Control library focused on fluent design and bringing more WinUI controls into Avalonia
MIT License
1.01k stars 98 forks source link

SelectionStrip #358

Open robloo opened 1 year ago

robloo commented 1 year ago

Is your feature request related to a problem? Please describe.

Originally used in iOS/Android and Windows Apps like Office, segmented controls allow switching between views (like a TabStrip) or configuring settings/options with optional multi-selection.

It looks like there is finally some movement on this by Microsoft:

Describe the solution you'd like

I first want to know if a contribution of these controls will be accepted in this project? If so, I will plan to port them over at some point in the future once upstream stabilizes. Eventually, I would expect Avalonia itself to get controls like this so perhaps that would be next step.

Describe alternatives you've considered

There are several alternative designs possible but none as concise.

Additional context Add any other context or screenshots about the feature request here.

amwx commented 1 year ago

Short answer - yes.

In general, I don't see this being much different from the existing TabStrip aside from multi-selection - which I do struggle to see where this control is an advantage over some type of toolbar. The WinUI discussion link was always using Bold/Italic/Underline which are traditionally in a toolbar. There's also the question of how "advanced" should the multi-selection support be (behave like checkboxes, radio buttons, or both). It does makes me wonder if the TabStrip should be restyled to this rather than following the TabControl (this could be done even with the control added)? These are just my immediate thoughts - not an opposition to adding the control. I do think the control needs a better name, SegmentedControl or SegmentedView or whatever just sounds really weird to me.

Though, I do want to get to the stable release before I start taking community additions. I really need to get my major tasks completed first (new sample app, docs site, unit test project back up), which are all blocked for various reasons (which includes waiting for the breaking changes to stop from upstream).

robloo commented 1 year ago

I agree with all your points and had several similar thoughts around naming too. This is a longer term feature and I want to wait for upstream to stabilize then i will probably do another API cleanup pass as well. This is several months away (if not a year).

When switching views this control is the same as tabstrip. However, when configuring options or settings it's more like radio buttons until you support multiple selections -- then it becomes something new -- a group of toggle buttons for the most part.

amwx commented 1 year ago

For the new sample app, I've copied some pages from the WinUI 3 gallery where I just remembered they're using this control. I didn't want to add that control at the time so I just used a normal TabStrip with an alternate style (akin to the RGB/HSV buttons in both color pickers), but that wasn't really working when wrapping on smaller screens. So I did a quick attempt at the styles for this control but on the TabStrip/TabStripItem (nothing fancy like making the items equal size or anything), but I think looks pretty good and solves my issue with wrapping much more nicely. I think I'll just add this as an alternate TabStrip/TabStripItem style until we have a more formal API discussion as this control

Preview: ezgif com-video-to-gif(2)

robloo commented 1 year ago

That looks great and sounds like a good plan for now!

I also made the following comments upstream relevant to this discussion:

more trying to fill a gap between groups of Toggle/RadioButtons.

Makes sense. I think a group of toggle buttons is fundamentally the only new thing a segmented control can do. It's already possible to restyle a group of radio buttons and has been for some time.

The real power of this control though is not filling that one little "grouped toggle buttons" feature gap. It's generalizing both the designs and control API to unify all these settings/option type use cases into one control.

I also know the TabStrip type view selection mode is technically a violation of standard conventions. But because there is no TabStrip in WinUI I think this control again serves as an interesting option. It again unifies some things that at first appear to be different but perhaps, fundamentally, are not.

manfromarce commented 5 months ago

I would suggest leaving the TabStrip single selection only so that it's equivalent to WinUi SelectorBar/Pivot/single-selection SegmentedControl, and making a new control similar to Chips (named as you prefer) which would serve multi-selection purposes, e.g. filtering, and makes more sense than multiple selected tabs which can be confusing to users: image image

robloo commented 5 months ago

Selection in the proposed control would be switchable between Single and Multiple just like selecting items controls. I don't see a reason to not share a base control for all of this.

There is definitely a need for multiple control themes/ styles based on usage. But the underlying control logic can be unified.

Edit: And Chips is a different control. It more represents Tokens that can be added/removed/modified. That's different from a control that can be used for selection of various items in a "fixed" layout.