You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ToggleSwitch and ToggleSwitchButton works differently depending whether user clicked on it or dragged it
To Reproduce
xaml:
<StackPanel Orientation="Vertical">
<mah:ToggleSwitch IsChecked="{Binding IsA, Mode=TwoWay}" OnLabel="A" OffLabel="Not A"></mah:ToggleSwitch>
<mah:ToggleSwitchButton IsChecked="{Binding IsA, Mode=TwoWay}" >A?</mah:ToggleSwitchButton>
<ToggleButton IsChecked="{Binding IsA, Mode=TwoWay}" >A??</ToggleButton>
<CheckBox IsChecked="{Binding IsA, Mode=TwoWay}" >A??</CheckBox>
</StackPanel>
view model (PropertyChanged is injected by Fody.PropertyChanged)
public class TestViewModel : INotifyPropertyChanged {
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged ([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) {
PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (propertyName));
}
private bool _IsA { get; set; }
public bool IsA { get { return _IsA; } set { MaybeSetA (value); } }
private void MaybeSetA (bool value) {
var rand = new Random ();
if (rand.NextDouble () > 0.5) {
Trace.WriteLine ("set new value");
_IsA = value;
} else {
Trace.WriteLine ("ignore new value");
}
}
}
Expected behavior
I expect state of the control to change depending whether MaybeSetA() decides to accept new value or not. This is so if user clicks on ToggleSwitch/ToggleSwitchButton, but not if user drags indicator. ToggleButton and CheckBox work as expected (but they are not part of MahApps). All the controls should be in the same state all the time, as they are bound to the same property. Screenshots
Environment(please complete the following information):
MahApps.Metro, tested both with newest and newest -pre
ToggleSwitch and ToggleSwitchButton works differently depending whether user clicked on it or dragged it
To Reproduce
xaml:
view model (PropertyChanged is injected by Fody.PropertyChanged)
Expected behavior
I expect state of the control to change depending whether MaybeSetA() decides to accept new value or not. This is so if user clicks on ToggleSwitch/ToggleSwitchButton, but not if user drags indicator. ToggleButton and CheckBox work as expected (but they are not part of MahApps). All the controls should be in the same state all the time, as they are bound to the same property.
Screenshots
Environment(please complete the following information):
Repo
https://github.com/DomasM/TestMahAppsToggleSwitch
run Update-Package Fody -Reinstall after clone
The text was updated successfully, but these errors were encountered: