question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ToggleSwitch.IsChecked not change yet at CheckChangedCommand

See original GitHub issue

Describe the bug When CheckChangedCommand called, the CheckChangedCommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}" is the old value.

To Reproduce

<controls:ToggleSwitch IsChecked="{Binding xxx}"
                       CheckChangedCommand="..."
                       CheckChangedCommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}" />
void ExecuteCheckChanged(bool? isChecked) {
    // isChecked is the old value, in other words it's false if checked and true if unchecked 
    // But CheckedCommand and UnCheckedCommand works as expected
}

Expected behavior it’s true if checked and false if unchecked.

Environment(please complete the following information):

  • MahApps.Metro version [v1.6.5]
  • OS: [Win10 1809]
  • Visual Studio [2017 15.9.11]
  • .NET Framework [4.6.2]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
AKruiminkcommented, Nov 17, 2019

If this has been resolved, feel free to close the issue 👍

1reaction
GF-Huangcommented, Nov 17, 2019

You’re right, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why won't IsChecked change on this toggle button?
I tried your ToggleButton and it's working fine. The only problem I see with it is that you set Command explictly.
Read more >
Prevent ToggleSwitch animation if IsChecked is changed ...
Hello, Is there a way to prevent the animation for the ToggleSwitch from happening if updating the IsChecked property from code behind?
Read more >
ToggleButton.IsChecked Property (System.Windows. ...
Gets or sets whether the ToggleButton is checked. ... put the CheckBox in an indeterminate state, but the user cannot set the CheckBox...
Read more >
ToggleSwitch
Use a ToggleSwitch control to let the user switch an option between on and off states. Use the IsOn property to determine the...
Read more >
How can I check if the switch is on or off - HTML & CSS
Indicates whether the element is checked or not. Use hasAttribute() to determine whether this attribute is set instead of getAttribute() . For ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found