AB4D Forum

Full Version: Binding not working any ab3d elements
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to bind the heading, attitude and bank of a target position camera to a viewmodel.  
The viewmodel is set as a DataContext to the parent containing the user control containing the ab3d camera and other ab3d elements.
The binding to viewmodel works on wpf elements but does not work on any ab3d elements. Why?
Many objects in the Ab3d.PowerToys library use WPF's DependencyProperties that should support binding - also Heading, Attitude and Bank are implemented with DependencyProperties and therefore can be used with binding.

I am not an expert on binding but anyway to try to help you, I would need more information about which properties do you want to bind to and what method do you use to do that.

However, except for simple cases like camera angles and similar, I would not recommend using binding on 3D objects because binding is very slow and can make the code more complicated. The number of 3D objects can quickly become high and then binding will slow down the whole application. Therefore please use binding with causion.

to debug bindings there are multiple ways. If you use Visual Studio (and I assume Rider or other IDE should have something similar), you can look into the output window for logs. Bindings are not very informative so you might need to set them more verbose - Tools -> Options -> Debugging -> Output window (just set Data binding to verbose). This should tell you if and why the bindings failed.

You can also use tools like snoopwpf/snoopwpf: Snoop - The WPF Spy Utility (github.com) that attaches to the process and you can identify if the view model is truly correct.

In the case you are using VS 2019, then the recent versions should also have xaml bindings failures window (under Debug->Windows).