This project has moved. For the latest updates, please go here.

Possible binding bug in child window with possible location

Jun 16, 2011 at 9:09 AM

Hi

I get these errors in the debug output.

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=Left; DataItem=null; target element is 'TranslateTransform' (HashCode=14396545); target property is 'X' (type 'Double')

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=Top; DataItem=null; target element is 'TranslateTransform' (HashCode=14396545); target property is 'Y' (type 'Double')

I believe it's when showing the child window.

 

Maybe it's here?

Src\WPFToolkit.Extended\ChildWindow\Themes\Generic.xaml 

line 130:    <TranslateTransform X="{Binding Left}" Y="{Binding Top}"/>

Jun 16, 2011 at 1:21 PM

Don't worry, this is not a bug and does not affect the behavior of the control.

Jun 16, 2011 at 9:19 PM

I guess that's how you define a bug, I think something that outputs error should be fixed.

 

Anyway when you don't like binding errors to be silent (http://bea.stollnitz.com/blog/?p=52http://www.jasonbock.net/JB/Default.aspx?blog=entry.0f221e047de740ee90722b248933a28dhttp://www.ontheblog.net/CMS/Home/tabid/36/EntryID/77/Default.aspx), it's a bit annoying

Jun 16, 2011 at 10:11 PM

If it bothers you that much you have two options:

  1. Ignore your output window (joke)
  2. Comment out the code that loads the FocusVisualStyle on line 438 in ChildWindow.cs.

This is an issue with how the .NET framework is resolving the bindings for the TranslateTransform in the focus visual stytle.  This only happens initially and then the bindings are correctly created and you no longer see the output error.  If the bindings were never correct, then you would constantly see the output erros which would be even more annoying.  If you don't care about the FocusVisualStyle, which is only used when the ChildWindow.IsTabStop=true, by default it is false, then you can simply comment out the code that sets it.  I understand it may annoy you, but it doesn't affect functionality which is most important.  To my knowledge this can't be fixed.  I may be missing the obvious, but until someone points it out to me it will remain unchanged.

Jun 17, 2011 at 7:45 AM

Hmm I'm not so keen on updating 3rd party libraries, it will turn into too much maintenance I'm afraid.

So I ended up changing the "throw-binding-error-service" to ignore the error messages by childwindow.