C
Join ServerC#
help
Cannot find governing FrameworkElement or FrameworkContentElement for target element
Ccarrotther8/25/2022
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')
Ccarrotther8/25/2022
I read somewhere that this is due to there being no DataContext available for my custom input binding thing (called
CustomInputBindingThing
)Ccarrotther8/25/2022
but even after making
CustomInputBindingThing
extend FrameworkElement
, i stopped getting the error but the command still didn't bindCcarrotther8/25/2022
it works fine if i use the normal built in InputBindings though
Ccarrotther8/25/2022
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 objectCcarrotther8/25/2022
but it's internal so it might be that 😦