Skip to content

Commit ff5f05a

Browse files
Address toggle compatibility review feedback
Agent-Logs-Url: https://github.com/webprofusion/certify/sessions/616a86b7-12dc-41e0-95ad-0d2a2b433894 Co-authored-by: webprofusion-chrisc <2445502+webprofusion-chrisc@users.noreply.github.com>
1 parent 9363895 commit ff5f05a

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

src/Certify.UI.Shared/Controls/Fluent/MahAppsCompatibility.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,20 @@ public class ToggleSwitch : CheckBox
240240

241241
public ToggleSwitch()
242242
{
243-
Checked += (_, _) => IsOn = true;
244-
Unchecked += (_, _) => IsOn = false;
243+
Checked += (_, _) =>
244+
{
245+
if (IsOn != true)
246+
{
247+
IsOn = true;
248+
}
249+
};
250+
Unchecked += (_, _) =>
251+
{
252+
if (IsOn != false)
253+
{
254+
IsOn = false;
255+
}
256+
};
245257
}
246258

247259
public bool? IsOn
@@ -254,7 +266,11 @@ private static void OnIsOnChanged(DependencyObject d, DependencyPropertyChangedE
254266
{
255267
if (d is ToggleSwitch toggleSwitch)
256268
{
257-
toggleSwitch.IsChecked = (bool?)e.NewValue;
269+
var isOn = (bool?)e.NewValue;
270+
if (toggleSwitch.IsChecked != isOn)
271+
{
272+
toggleSwitch.IsChecked = isOn;
273+
}
258274
}
259275
}
260276
}

0 commit comments

Comments
 (0)