C
C#•3y ago
bighugemassive3

Cannot find governing FrameworkElement or FrameworkContentElement for target element

I'm trying to make something similar to the UIElement's InputBindings, but for some reason, I'm getting this error in the debug output:
Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=DoSomethingCommand; DataItem=null; target element is 'CustomInputBindingThing' (HashCode=53330552); target property is 'Command' (type 'ICommand')
Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=DoSomethingCommand; DataItem=null; target element is 'CustomInputBindingThing' (HashCode=53330552); target property is 'Command' (type 'ICommand')
1 Reply
bighugemassive3
bighugemassive3OP•3y ago
I read somewhere that this is due to there being no DataContext available for my custom input binding thing (called CustomInputBindingThing) but even after making CustomInputBindingThing extend FrameworkElement, i stopped getting the error but the command still didn't bind it works fine if i use the normal built in InputBindings though even though the source code for the built in version and my own are basically the same; InputBindingCollection inherits IList, and so does mine, and CustomInputBindingThing extends Freezable and ICommandSource just like the original InputBinding class. The only thing that seems to be missing though is something called InheritanceContext, which is a dependency object but it's internal so it might be that 😦

Did you find this page helpful?