dotnet/wpf · error · NotImplementedException

NotImplementedException (ConvertBack not supported)

Error message

NotImplementedException (ConvertBack not supported)

What it means

Fluent theme's AnimationFactorToValueConverter implements IMultiValueConverter but its ConvertBack deliberately throws NotImplementedException — round-tripping a bound value back to the animation factor is not supported. Data binding in TwoWay/OneWayToSource mode against this converter will crash the binding.

Solutions

  1. Set the binding Mode explicitly to OneWay so ConvertBack is never called.
  2. If a round-trip is needed, implement ConvertBack to compute the factor from the value or throw a NotSupportedException with a clear message.
  3. Use a different converter that supports TwoWay conversion.

Example fix

// before
<MultiBinding Converter="{StaticResource AnimationFactorToValueConverter}" Mode="TwoWay">
// after
<MultiBinding Converter="{StaticResource AnimationFactorToValueConverter}" Mode="OneWay">
Defensive patterns

Strategy: validation

Validate before calling

if (binding.Mode != BindingMode.OneWay)
    throw new InvalidOperationException("AnimationFactorToValueConverter only supports OneWay bindings.");

Try / catch

// ConvertBack is invoked inside the binding engine; guard at binding setup time
try { ApplyBinding(); }
catch (NotImplementedException ex) { log.LogError("Converter does not support ConvertBack"); }

Prevention

When it happens

Trigger: Using AnimationFactorToValueConverter in a MultiBinding with Mode=TwoWay or OneWayToSource, causing WPF to invoke ConvertBack.

Common situations: Developers binding animation progress factors back to source properties; copy-pasting a OneWay binding into TwoWay when refactoring; template re-targeting in the Fluent theme.

Related errors


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/d66498f81f1c9850. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Controls/AnimationFactorToValueConverter.cs:34

                return 0.0;
            }

            if (values[1] is not double factor || factor == double.NaN)
            {
                return 0.0;
            }

            if (parameter is "negative")
            {
                factor = -factor;
            }

            return factor * completeValue;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}

View on GitHub (pinned to 81131a70a4)