dotnet/wpf · error · InvalidOperationException

SR.MultiBindingHasNoConverter

Error message

SR.MultiBindingHasNoConverter

What it means

MultiBinding throws InvalidOperationException when it has neither a Converter nor a StringFormat. Without a converter, WPF cannot combine the values of the child bindings into a single target value, so the binding expression cannot be created.

Solutions

  1. Set a Converter (an IMultiValueConverter implementation) on the MultiBinding
  2. Or set StringFormat (e.g. StringFormat="{}{0} {1}") if a format is sufficient
  3. Verify the converter StaticResource resolved to a non-null IMultiValueConverter

Example fix

<!-- before -->
<MultiBinding>
  <Binding Path="First"/>
  <Binding Path="Last"/>
</MultiBinding>
<!-- after -->
<MultiBinding Converter="{StaticResource nameConverter}">
  <Binding Path="First"/>
  <Binding Path="Last"/>
</MultiBinding>
Defensive patterns

Strategy: validation

Validate before calling

if (multiBinding.Converter == null && string.IsNullOrEmpty(multiBinding.StringFormat)) throw new InvalidOperationException("MultiBinding needs a Converter or StringFormat");

Try / catch

try { BindingOperations.SetBinding(t, p, multiBinding); } catch (InvalidOperationException) { /* add converter */ }

Prevention

When it happens

Trigger: Using <MultiBinding> with only child <Binding> elements and no Converter property and no StringFormat; setting MultiBinding.Converter to null and StringFormat to empty at runtime before attaching the binding.

Common situations: Forgetting Converter when a multi-binding is first written in XAML; a converter resource fails to resolve (StaticResource returns null) so Converter stays null; default TwoWay multi-bindings where IMultiValueConverter is required.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/MultiBinding.cs:341

                ChangeFlag(BindingFlags.ValidatesOnNotifyDataErrors, value);
            }
        }
    }

    //------------------------------------------------------
    //
    //  Protected Methods
    //
    //------------------------------------------------------

    /// <summary>
    /// Create an appropriate expression for this Binding, to be attached
    /// to the given DependencyProperty on the given DependencyObject.
    /// </summary>
    internal override BindingExpressionBase CreateBindingExpressionOverride(DependencyObject target, DependencyProperty dp, BindingExpressionBase owner)
    {
        if (Converter == null && String.IsNullOrEmpty(StringFormat))
            throw new InvalidOperationException(SR.MultiBindingHasNoConverter);

        for (int i = 0; i < Bindings.Count; ++i)
        {
            CheckTrigger(Bindings[i]);
        }

        return MultiBindingExpression.CreateBindingExpression(target, dp, this, owner);
    }

    internal override ValidationRule LookupValidationRule(Type type)
    {
        return LookupValidationRule(type, ValidationRulesInternal);
    }

    //------------------------------------------------------
    //
    //  Internal Methods
    //

View on GitHub (pinned to 81131a70a4)