Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adding a bindable Off state Color for Switch #15695

Closed
Andy-Donegan opened this issue Jun 16, 2023 · 2 comments · Fixed by #25068
Closed

Adding a bindable Off state Color for Switch #15695

Andy-Donegan opened this issue Jun 16, 2023 · 2 comments · Fixed by #25068

Comments

@Andy-Donegan
Copy link

Description

Currently you can set the OnColor state for a switch but can not set the OffColor state. This leads to having to use a custom solution for myself. This Stack Question highlights the issue when placing a Switch on a Black/dark background the off state dissapears into the background and you are just left with the Thumb selector.
Stack Overflow Question with Images

Public API Changes

 <Style x:Key ="ToggleSwitch" TargetType="Switch">
        <Setter Property="VisualStateManager.VisualStateGroups">
            <VisualStateGroupList>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="On">
                        <VisualState.Setters>
                            <Setter Property="OnColor"
                            Value="Green" />
                        </VisualState.Setters>
                    </VisualState>
                    <VisualState x:Name="Off">
<!-- Here is the new suggested proper of OffColor -->
                        <VisualState.Setters>
                            <Setter Property="OffColor"
                            Value="Gray" />
                        </VisualState.Setters>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateGroupList>
        </Setter>
    </Style>

Intended Use-Case

My current app requires a Dark background (black currently) using the Switch with the ability to set the offstate color would allow me to use the Switch in any coloured environment.

@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Jun 16, 2023
@jsuarezruiz jsuarezruiz added this to the Backlog milestone Jun 26, 2023
@ghost
Copy link

ghost commented Jun 26, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
@PureWeen PureWeen modified the milestones: Backlog, .NET 9 Servicing Dec 4, 2024
@jfversluis
Copy link
Member

Merged for .NET 10, should be available in preview 2

@github-project-automation github-project-automation bot moved this from Todo to Done in MAUI SDK Ongoing Feb 13, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants