{"record":{"id":"6b0385cf2db532a4","repo":"dotnet/wpf","slug":"notimplementedexception-convertback-not-supported-6b0385","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/FallbackBrushConverter.cs","lineNumber":31,"sourceCode":"        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            if (value is SolidColorBrush brush)\n            {\n                return brush;\n            }\n\n            if (value is Color color)\n            {\n                return new SolidColorBrush(color);\n            }\n\n            // We draw red to visibly see an invalid bind in the UI.\n            return Brushes.Red;\n        }\n\n        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            throw new NotImplementedException();\n        }\n    }\n}\n","sourceCodeStart":13,"sourceCodeEnd":35,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Controls/FallbackBrushConverter.cs#L13-L35","documentation":"FallbackBrushConverter.Convert unconditionally returns a fallback brush (red for invalid binds), but ConvertBack throws NotImplementedException by design — this converter is one-way only. Any binding that invokes ConvertBack (TwoWay/OneWayToSource) fails.","triggerScenarios":"Using FallbackBrushConverter in a Binding with Mode=TwoWay or OneWayToSource so WPF calls ConvertBack.","commonSituations":"Using the Fluent theme's fallback brush converter in editable or two-way scenarios; accidental default-mode bindings in styles.","solutions":["Set binding Mode=OneWay explicitly.","Remove the converter if the property must be two-way and pick a convertible type.","Implement ConvertBack in a derived/alternative converter if round-tripping is genuinely needed."],"exampleFix":"// before\n<TextBlock Background=\"{Binding SomeBrush, Converter={StaticResource FallbackBrushConverter}, Mode=TwoWay}\" />\n// after\n<TextBlock Background=\"{Binding SomeBrush, Converter={StaticResource FallbackBrushConverter}, Mode=OneWay}\" />","handlingStrategy":"validation","validationCode":"if (binding.Mode != BindingMode.OneWay)\n    throw new InvalidOperationException(\"FallbackBrushConverter is one-way only.\");","typeGuard":null,"tryCatchPattern":"try { ApplyBinding(); }\ncatch (NotImplementedException) { log.LogError(\"FallbackBrushConverter does not support ConvertBack\"); }","preventionTips":["Use one-way bindings for brush conversions.","Never reuse display-fallback converters for editable data.","Document one-only converters in the theme's README."],"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"}