Skip to content

MaterialDesignSwitchToggleButton: 'System.Windows.Media.Animation.DoubleAnimation' cannot use default origin value of 'NaN' on Window Exit #3740

@TWhidden

Description

@TWhidden

Bug explanation

Moving to Material Design 3. Having a problem with MaterialDesignSwitchToggleButton. The other ToggleButtons styles don't appear to have this exception.

When closing the parent window after this style has been loaded, I get an exception. I am guessing the exit animation is causing this. Not sure if it's because there is no from value?

I am still researching this and have not created a side project to test this yet. That will be next, but under pressure to finish this project, so will select a different style for the meantime.

Exception is crazy long, so will post the final part of it.

System.InvalidOperationException: 'System.Windows.Media.Animation.DoubleAnimation' cannot use default origin value of 'NaN'.
   at System.Windows.Media.Animation.DoubleAnimation.GetCurrentValueCore(Double defaultOriginValue, Double defaultDestinationValue, AnimationClock animationClock)
   at System.Windows.Media.Animation.DoubleAnimationBase.GetCurrentValue(Object defaultOriginValue, Object defaultDestinationValue, AnimationClock animationClock)
   at System.Windows.Media.Animation.AnimationStorage.GetCurrentPropertyValue(AnimationStorage storage, DependencyObject d, DependencyProperty dp, PropertyMetadata metadata, Object baseValue)
   at System.Windows.Media.Animation.AnimationStorage.EvaluateAnimatedValue(PropertyMetadata metadata, EffectiveValueEntry& entry)
   at System.Windows.UIElement.EvaluateAnimatedValueCore(DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry& entry)

More to come - but opening this up just in case there is something obvious I may be missing.

Xaml usage:

<ToggleButton Style="{DynamicResource MaterialDesignSwitchToggleButton}"
              ToolTip="Something"
              IsChecked="{Binding SomeBoolBinding, Mode=TwoWay}"
              Margin="2" />

Version

5.1.0

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions