stride3d/stride · error · ArgumentException
PropertyName must be set.
Error message
PropertyName must be set.
What it means
OnFocusBindingInterruptionBehavior interrupts a WPF binding on a dependency property while the element has keyboard focus, so typed input is not overwritten by binding updates. In OnAttached it first validates that the PropertyName behavior property is a non-empty, non-whitespace string. If it was never set (or is blank), it throws ArgumentException to fail fast instead of producing a silently non-functional behavior.
Solutions
- Set the PropertyName property on the behavior to the exact name of the target dependency property, e.g. PropertyName="Text".
- Verify PropertyName is not empty or whitespace at runtime before the element loads (e.g. if set via binding/data, ensure it evaluates before OnAttached).
- If the behavior is not needed, remove it from the interaction Behaviors collection entirely instead of leaving an unconfigured instance.
Example fix
<!-- before -->
<i:Interaction.Behaviors>
<b:OnFocusBindingInterruptionBehavior Binding="{Binding Name}" />
</i:Interaction.Behaviors>
<!-- after -->
<i:Interaction.Behaviors>
<b:OnFocusBindingInterruptionBehavior PropertyName="Text" Binding="{Binding Name}" />
</i:Interaction.Behaviors> Defensive patterns
Strategy: validation
Validate before calling
var behavior = new OnFocusBindingInterruptionBehavior();
if (string.IsNullOrWhiteSpace(behavior.PropertyName))
throw new InvalidOperationException("Set PropertyName before attaching OnFocusBindingInterruptionBehavior."); Try / catch
try { BehaviorCollectionHelper.Attach(behavior); }
catch (ArgumentException ex) when (ex.Message == "PropertyName must be set.") { log.Error("Behavior misconfigured: PropertyName missing"); } Prevention
- Always pair PropertyName and Binding attributes when using OnFocusBindingInterruptionBehavior in XAML.
- Create a reusable XAML snippet/style that includes both required properties.
- Review behaviors during code review for both required attributes before merging.
When it happens
Trigger: Attaching OnFocusBindingInterruptionBehavior via XAML or code without setting its PropertyName property, e.g. <behaviors:OnFocusBindingInterruptionBehavior Binding="{Binding SomePath}"/> with no PropertyName attribute, or setting PropertyName="" or whitespace.
Common situations: Copying the behavior usage from an example but deleting the PropertyName attribute; binding PropertyName to a resource/ViewModel value that resolves to empty at attach time; renaming the target property and clearing the attribute accidentally.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- The PropertyName property must be set on behavior '{GetType(
- Binding must be set for {PropertyName} property of host '{As
- Impossible to find property named '{PropertyName}' on object
- Unable to find property '{PropertyName}' on object of type '
- This behavior must be attached to an instance of TreeViewIte
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/3de5f31910dd61cd.
Report an issue: GitHub.
Appendix: source
Thrown at sources/presentation/Stride.Core.Presentation.Wpf/Behaviors/OnFocusBindingInterruptionBehavior.cs:36
/// <remarks>The host element must be of type <c>UIElement</c> and the <c>DependencyProprty</c> defined by PropertyName property must be set to a <c>BindingBase</c> object.</remarks>
public class OnFocusBindingInterruptionBehavior : Behavior<DependencyObject>
{
private IDisposable subscriber;
private DependencyProperty property;
/// <summary>
/// Gets or sets the name of the DependencyProperty on which the Binding has to be interrupted.
/// </summary>
public string PropertyName { get; set; }
/// <summary>
/// Gets or sets the binding to apply on the Host property defined by 'PropertyName' behavior property.
/// </summary>
public BindingBase Binding { get; set; }
protected override void OnAttached()
{
if (string.IsNullOrWhiteSpace(PropertyName))
throw new ArgumentException("PropertyName must be set.");
if (Binding == null)
{
throw new ArgumentException($"Binding must be set for {PropertyName} property of host '{AssociatedObject}' on behavior '{GetType().FullName}'.");
}
property = AssociatedObject.GetDependencyProperties(true).FirstOrDefault(dp => dp.Name == PropertyName);
if (property == null /* need to check DesignMode as well ? */)
throw new InvalidOperationException($"Impossible to find property named '{PropertyName}' on object typed '{AssociatedObject.GetType()}'.");
if ((Binding is Binding) == false)
throw new InvalidOperationException("Not supported binding type.");
var element = AssociatedObject as FrameworkElement;
if (element == null)
{
throw new InvalidOperationException(View on GitHub (pinned to 96fad776d2)