{"record":{"id":"d66498f81f1c9850","repo":"dotnet/wpf","slug":"notimplementedexception-convertback-not-supported","errorCode":null,"errorMessage":"NotImplementedException (ConvertBack not supported)","messagePattern":"NotImplementedException \\(ConvertBack not supported\\)","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Controls/AnimationFactorToValueConverter.cs","lineNumber":34,"sourceCode":"                return 0.0;\n            }\n\n            if (values[1] is not double factor || factor == double.NaN)\n            {\n                return 0.0;\n            }\n\n            if (parameter is \"negative\")\n            {\n                factor = -factor;\n            }\n\n            return factor * completeValue;\n        }\n\n        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)\n        {\n            throw new NotImplementedException();\n        }\n    }\n}\n","sourceCodeStart":16,"sourceCodeEnd":38,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Controls/AnimationFactorToValueConverter.cs#L16-L38","documentation":"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.","triggerScenarios":"Using AnimationFactorToValueConverter in a MultiBinding with Mode=TwoWay or OneWayToSource, causing WPF to invoke ConvertBack.","commonSituations":"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.","solutions":["Set the binding Mode explicitly to OneWay so ConvertBack is never called.","If a round-trip is needed, implement ConvertBack to compute the factor from the value or throw a NotSupportedException with a clear message.","Use a different converter that supports TwoWay conversion."],"exampleFix":"// before\n<MultiBinding Converter=\"{StaticResource AnimationFactorToValueConverter}\" Mode=\"TwoWay\">\n// after\n<MultiBinding Converter=\"{StaticResource AnimationFactorToValueConverter}\" Mode=\"OneWay\">","handlingStrategy":"validation","validationCode":"if (binding.Mode != BindingMode.OneWay)\n    throw new InvalidOperationException(\"AnimationFactorToValueConverter only supports OneWay bindings.\");","typeGuard":null,"tryCatchPattern":"// ConvertBack is invoked inside the binding engine; guard at binding setup time\ntry { ApplyBinding(); }\ncatch (NotImplementedException ex) { log.LogError(\"Converter does not support ConvertBack\"); }","preventionTips":["Default to Mode=OneWay when using theme-supplied converters.","Read the converter implementation before using it in TwoWay bindings.","Write unit tests that assert binding direction for each converter usage."],"tags":["wpf","converter","data-binding"],"backgroundTag":"method-not-implemented","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}