Skip to content
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

Switch does not update when setting IsToggled from code #5226

Closed
Dbquity opened this issue Mar 11, 2022 · 1 comment · Fixed by #5276
Closed

Switch does not update when setting IsToggled from code #5226

Dbquity opened this issue Mar 11, 2022 · 1 comment · Fixed by #5276
Assignees
Labels
area-controls-switch Switch fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! high It doesn't work at all, crashes or has a big impact. s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@Dbquity
Copy link

Dbquity commented Mar 11, 2022

Description

I have a Switch control on a ContentPage, and it keeps showing its original state, when I change IsToggled from code.

Steps to Reproduce

  1. Create a new Maui App
  2. Replace the label in row 1 with a Switch in MainPage.xaml , like so:
<Switch 
    Grid.Row="1"
    IsToggled="True"
    x:Name="EvenToggle"
    HorizontalOptions="Center" />
  1. update the toggle in the click-handler of MainPage.xaml.cs:
private void OnCounterClicked(object sender, EventArgs e)
{
    count++;
    CounterLabel.Text = $"Current count: {count}";
    EvenToggle.IsToggled = count % 2 == 0;

    SemanticScreenReader.Announce(CounterLabel.Text);
}
  1. Run and observe that you can set the toggle by clicking it, but it does not update when clicking the [Click me] button

Version with bug

Preview 13 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows and Android

Affected platform versions

Windows 10 Machine and Android Pixel 5 - API 30 emulator

Did you find any workaround?

No

Relevant log output

No response

@Dbquity Dbquity added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Mar 11, 2022
@jfversluis jfversluis added legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-controls-switch Switch and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Mar 11, 2022
@Amir-Care Amir-Care added the s/triaged Issue has been reviewed label Mar 14, 2022
@v-longmin v-longmin added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/triaged Issue has been reviewed labels Mar 14, 2022
@v-longmin
Copy link

v-longmin commented Mar 14, 2022

Verified the issue on windows and android, the issue also reproes.
[MauiApp7.zip]("\\mlangfs1\Public\dotnet maui\Repro Project\MauiApp7.zip")

@jsuarezruiz jsuarezruiz self-assigned this Mar 14, 2022
@jsuarezruiz jsuarezruiz added the high It doesn't work at all, crashes or has a big impact. label Mar 14, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 20, 2022
@samhouts samhouts added the fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! label Feb 17, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-switch Switch fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! high It doesn't work at all, crashes or has a big impact. s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants