dotnet/wpf · error · ArgumentException
SR.PropertyNotBindable (formatted with dp.Name)
Error message
SR.PropertyNotBindable (formatted with dp.Name)
What it means
MultiBindingExpression.CreateBindingExpression throws ArgumentException when the target DependencyProperty cannot accept data binding: its FrameworkPropertyMetadata has IsDataBindingAllowed == false or the property is read-only. Applying SetBinding/SetMultiBinding to such a property is rejected with the property name in the message.
Solutions
- Choose a writable, bindable dependency property as the binding target
- If the property is read-only, bind a related writable property or use OneWayToSource on a different target
- Check dp.ReadOnly and FrameworkPropertyMetadata.IsDataBindingAllowed before calling SetBinding
Example fix
// before textBlock.SetBinding(TextBlock.ActualWidthProperty, multiBinding); // read-only // after textBlock.SetBinding(TextBlock.WidthProperty, multiBinding); // bindable target
Defensive patterns
Strategy: validation
Validate before calling
var md = dp.GetMetadata(d.DependencyObjectType) as FrameworkPropertyMetadata; bool bindable = md != null && md.IsDataBindingAllowed && !dp.ReadOnly;
Type guard
bool IsBindable(DependencyObject d, DependencyProperty dp) => dp.GetMetadata(d.DependencyObjectType) is FrameworkPropertyMetadata md && md.IsDataBindingAllowed && !dp.ReadOnly;
Try / catch
try { BindingOperations.SetBinding(d, dp, multiBinding); } catch (ArgumentException ex) when (ex.ParamName == "dp") { /* property not bindable */ } Prevention
- Never target read-only DPs like ActualWidth or IsLoaded
- Check IsDataBindingAllowed before SetBinding in generic helpers
- Confirm the correct DependencyProperty field when several share a name
When it happens
Trigger: Calling BindingOperations.SetBinding(d, dp, new MultiBinding(...)) where dp is a read-only dependency property (e.g. registered with ReadOnly) or has metadata blocking binding; using a MultiBinding on a property with FrameworkPropertyMetadata options like NotDataBindable.
Common situations: Targeting read-only properties such as ActualWidth/IsLoaded; typos choosing the wrong DependencyProperty field; custom controls that registered a property read-only but a template tries to bind it.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Animation_DependencyPropertyIsNotAnimatable
- Animation_CalculatedValueIsInvalidForProperty
- Animation_ChildMustBeKeyFrame
- Animation_UnrecognizedHandoffBehavior
- InvalidEnumArgumentException for value (TextTrimming)
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/db03143f781f3536.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/MultiBindingExpression.cs:159
internal override bool IsParentBindingUpdateTriggerDefault
{
get { return (ParentMultiBinding.UpdateSourceTrigger == UpdateSourceTrigger.Default); }
}
//------------------------------------------------------
//
// Internal Methods
//
//------------------------------------------------------
// Create a new BindingExpression from the given Binding description
internal static MultiBindingExpression CreateBindingExpression(DependencyObject d, DependencyProperty dp, MultiBinding binding, BindingExpressionBase owner)
{
FrameworkPropertyMetadata fwMetaData = dp.GetMetadata(d.DependencyObjectType) as FrameworkPropertyMetadata;
if ((fwMetaData != null && !fwMetaData.IsDataBindingAllowed) || dp.ReadOnly)
throw new ArgumentException(SR.Format(SR.PropertyNotBindable, dp.Name), nameof(dp));
// create the BindingExpression
MultiBindingExpression bindExpr = new MultiBindingExpression(binding, owner);
bindExpr.ResolvePropertyDefaultSettings(binding.Mode, binding.UpdateSourceTrigger, fwMetaData);
return bindExpr;
}
// Attach to things that may require tree context (parent, root, etc.)
private void AttachToContext(bool lastChance)
{
DependencyObject target = TargetElement;
if (target == null)
return;
Debug.Assert(ParentMultiBinding.Converter != null || !String.IsNullOrEmpty(EffectiveStringFormat),
"MultiBindingExpression should not exist if its bind does not have a valid converter.");View on GitHub (pinned to 81131a70a4)