ToggleSwitch.IsChecked not change yet at CheckChangedCommand
See original GitHub issueDescribe 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:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If this has been resolved, feel free to close the issue 👍
You’re right, thanks.