"Cannot find governing FrameworkElement" on WPF-Binding

Found a possible bug in LightningChart? Report it here.

Moderator: Queue Moderators

Post Reply
frank
Posts: 51
Joined: Tue Mar 25, 2014 9:04 am

"Cannot find governing FrameworkElement" on WPF-Binding

Post by frank » Fri Jan 30, 2015 1:34 pm

Hi,

as discussed here I use programmatical Binding like

Code: Select all

BindingOperations.SetBinding(_chart.ViewXY, ViewXY.GraphBorderColorProperty, new Binding { Path = new PropertyPath("AcceptedAreaColor") });
It worked, but since one of the newer versions of LC I get the following errors and the Binding doesn't work any more:

Code: Select all

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=AcceptedAreaColor; DataItem=null; target element is 'ViewXY' (HashCode=39482019); target property is 'GraphBackground' (type 'Fill')
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=AcceptedAreaColor; DataItem=null; target element is 'ViewXY' (HashCode=39482019); target property is 'GraphBorderColor' (type 'Color')
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=AxesColor; DataItem=null; target element is 'ZoomPanOptions' (HashCode=10044206); target property is 'ZoomRectLine' (type 'LineStyle')
Best regards,
Frank

ArctionJari

Re: "Cannot find governing FrameworkElement" on WPF-Binding

Post by ArctionJari » Fri Jan 30, 2015 2:57 pm

It's not a bug. You just have not set Binding object's Source property to 'this' like in the topic you provided a link for.

frank
Posts: 51
Joined: Tue Mar 25, 2014 9:04 am

Re: "Cannot find governing FrameworkElement" on WPF-Binding

Post by frank » Fri Jan 30, 2015 3:17 pm

:oops: Thanks, thats it. I thought it was working once, but probably I just forgot it in some places and it never did work. On googling the error I just found posts about the visual tree of WPF controls.
My apologies for this disruption.

Post Reply