dotnet/wpf · error · NotImplementedException

NotImplementedException (ConvertBack not supported)

Error message

NotImplementedException (ConvertBack not supported)

What it means

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.

Solutions

  1. Set binding Mode=OneWay explicitly.
  2. Remove the converter if the property must be two-way and pick a convertible type.
  3. Implement ConvertBack in a derived/alternative converter if round-tripping is genuinely needed.

Example fix

// before
<TextBlock Background="{Binding SomeBrush, Converter={StaticResource FallbackBrushConverter}, Mode=TwoWay}" />
// after
<TextBlock Background="{Binding SomeBrush, Converter={StaticResource FallbackBrushConverter}, Mode=OneWay}" />
Defensive patterns

Strategy: validation

Validate before calling

if (binding.Mode != BindingMode.OneWay)
    throw new InvalidOperationException("FallbackBrushConverter is one-way only.");

Try / catch

try { ApplyBinding(); }
catch (NotImplementedException) { log.LogError("FallbackBrushConverter does not support ConvertBack"); }

Prevention

When it happens

Trigger: Using FallbackBrushConverter in a Binding with Mode=TwoWay or OneWayToSource so WPF calls ConvertBack.

Common situations: Using the Fluent theme's fallback brush converter in editable or two-way scenarios; accidental default-mode bindings in styles.

Related errors


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Controls/FallbackBrushConverter.cs:31

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is SolidColorBrush brush)
            {
                return brush;
            }

            if (value is Color color)
            {
                return new SolidColorBrush(color);
            }

            // We draw red to visibly see an invalid bind in the UI.
            return Brushes.Red;
        }

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

View on GitHub (pinned to 81131a70a4)