Fixing two issues with the ToggleSwitch control: (1) The ToggleSwitch would still react to user interactions even if disabled (tested on Android 13), and (2) the ToggleSwitch's visual appearance did not match its actual value upon initialization.
This commit is contained in:
Родитель
bd81ba916d
Коммит
b9ca4d3ebe
|
@ -134,6 +134,8 @@ namespace AlohaKit.Controls
|
|||
Toggled?.Invoke(this, new ToggledEventArgs(IsOn));
|
||||
|
||||
Invalidate();
|
||||
|
||||
AnimateToggle();
|
||||
}
|
||||
|
||||
void UpdateHasShadow()
|
||||
|
@ -148,9 +150,10 @@ namespace AlohaKit.Controls
|
|||
|
||||
void OnToggleSwitchStartInteraction(object sender, TouchEventArgs e)
|
||||
{
|
||||
IsOn = !IsOn;
|
||||
|
||||
AnimateToggle();
|
||||
if (IsEnabled)
|
||||
{
|
||||
IsOn = !IsOn;
|
||||
}
|
||||
}
|
||||
|
||||
void AnimateToggle()
|
||||
|
|
Загрузка…
Ссылка в новой задаче