{"record":{"id":"773b6d250694cab2","repo":"stride3d/stride","slug":"not-supported-binding-type","errorCode":null,"errorMessage":"Not supported binding type.","messagePattern":"Not supported binding type\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Presentation.Wpf/Behaviors/OnFocusBindingInterruptionBehavior.cs","lineNumber":49,"sourceCode":"        public BindingBase Binding { get; set; }\n\n        protected override void OnAttached()\n        {\n            if (string.IsNullOrWhiteSpace(PropertyName))\n                throw new ArgumentException(\"PropertyName must be set.\");\n\n            if (Binding == null)\n            {\n                throw new ArgumentException($\"Binding must be set for {PropertyName} property of host '{AssociatedObject}' on behavior '{GetType().FullName}'.\");\n            }\n\n            property = AssociatedObject.GetDependencyProperties(true).FirstOrDefault(dp => dp.Name == PropertyName);\n\n            if (property == null /* need to check DesignMode as well ? */)\n                throw new InvalidOperationException($\"Impossible to find property named '{PropertyName}' on object typed '{AssociatedObject.GetType()}'.\");\n\n            if ((Binding is Binding) == false)\n                throw new InvalidOperationException(\"Not supported binding type.\");\n\n            var element = AssociatedObject as FrameworkElement;\n            if (element == null)\n            {\n                throw new InvalidOperationException(\n                    $\"Behavior of type '{GetType()}' must be bound to objects of type '{typeof(FrameworkElement)}'. (currently bound to object typed '{AssociatedObject.GetType()}')\");\n            }\n\n            BindingOperations.SetBinding(AssociatedObject, property, Binding);\n\n            // subscribe to *Focus events\n            element.GotFocus += OnHostGotFocus;\n            element.LostFocus += OnHostLostFocus;\n\n            subscriber = new AnonymousDisposable(() =>\n            {\n                // unsubscribe from *Focus events\n                element.LostFocus -= OnHostLostFocus;","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Presentation.Wpf/Behaviors/OnFocusBindingInterruptionBehavior.cs#L31-L67","documentation":"OnFocusBindingInterruptionBehavior calls BindingOperations.SetBinding, which only accepts System.Windows.Data.Binding, not derived/other BindingBase types like PriorityBinding or MultiBinding. When the supplied Binding is not a plain Binding, the behavior throws InvalidOperationException('Not supported binding type.').","triggerScenarios":"Setting the behavior's Binding property to a <MultiBinding> or <PriorityBinding>, or any custom BindingBase subclass; only System.Windows.Data.Binding instances pass the `(Binding is Binding)` check.","commonSituations":"Needing multiple sources for the interrupted value and reaching for MultiBinding without realizing this behavior only supports single-source Binding; refactoring a plain Binding into MultiBinding for a converter chain.","solutions":["Replace MultiBinding/PriorityBinding with a single Binding; move converter logic into a value converter on that one binding.","Flatten multiple sources via the ViewModel (expose a computed property) and bind that single property.","If multi-binding is essential, modify or subclass the behavior to handle the desired BindingBase type explicitly."],"exampleFix":"<!-- before -->\n<b:OnFocusBindingInterruptionBehavior PropertyName=\"Text\">\n  <b:OnFocusBindingInterruptionBehavior.Binding>\n    <MultiBinding Converter=\"{StaticResource MyConv}\">\n      <Binding Path=\"First\" />\n      <Binding Path=\"Last\" />\n    </MultiBinding>\n  </b:OnFocusBindingInterruptionBehavior.Binding>\n</b:OnFocusBindingInterruptionBehavior>\n\n<!-- after: expose FullName in the ViewModel and use a plain Binding -->\n<b:OnFocusBindingInterruptionBehavior PropertyName=\"Text\" Binding=\"{Binding FullName}\" />","handlingStrategy":"type-guard","validationCode":"if (behavior.Binding is not System.Windows.Data.Binding)\n    throw new InvalidOperationException(\"OnFocusBindingInterruptionBehavior requires a plain Binding, not MultiBinding/PriorityBinding.\");","typeGuard":"static bool IsPlainBinding(BindingBase b) => b is System.Windows.Data.Binding;","tryCatchPattern":"try { AttachBehavior(behavior, target); }\ncatch (InvalidOperationException ex) when (ex.Message == \"Not supported binding type.\") { log.Error(\"Use a single System.Windows.Data.Binding with this behavior\"); }","preventionTips":["Only assign <Binding> (single source) to this behavior's Binding property.","Move multi-source/converter logic into a value converter on a single Binding or into the ViewModel.","Comment the XAML where MultiBinding is tempting to prevent future regressions."],"tags":["wpf","binding","unsupported","behavior"],"backgroundTag":"unsupported-operation","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}