If a style is removed from a control when it's already detached from the visual tree, the animations associated with the style continue to run instead of stopping.
To Reproduce
With the following code, click the Detach Then Remove Class button.
Observe that the animation continues instead of stopping.
It works correctly if Remove Class Then Detach is clicked instead.
(Note that once the animation is in the wrong state from the first click, it won't stop even with that second button.)
This is a bit different than the usual "animations keep running when the control is invisible".
Here, the style is removed, so there's really no reason for the animations to continue.
Describe the bug
If a style is removed from a control when it's already detached from the visual tree, the animations associated with the style continue to run instead of stopping.
To Reproduce
With the following code, click the Detach Then Remove Class button. Observe that the animation continues instead of stopping.
It works correctly if Remove Class Then Detach is clicked instead. (Note that once the animation is in the wrong state from the first click, it won't stop even with that second button.)
Expected behavior
The animation stops when the associated style is removed.
Avalonia version
11.0.10, 11.1.0-beta2, master b30894cb5c1e2403b70e72853ffbd0176ad7c6dd
OS
No response
Additional context
This is a bit different than the usual "animations keep running when the control is invisible". Here, the style is removed, so there's really no reason for the animations to continue.