Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to apply SharpEngineSceneView to MVVM in SharpEngine.AvaloniaUI?
#1
We are currently conducting a test implementation of the ab4d SharpEngine as part of our ongoing tests. Our current project is being developed using the MVVM pattern, but we're encountering an issue where the SharpEngineSceneView is not binding. Any assistance or advice on how to successfully bind would be greatly appreciated.
#2
Ab4d.SharpEngine does not support binding. The first reason for that is performance - binding usually requires reflection and this may be very slow. Another reason is that binding is platform specific - WPF uses its own binding, WinUI and Avalonia also have their own.

Also, to enable binding support, the objects need to be derived from some specil objects - for example in WPF from FrameworkElement and the properties need to be defined as DepandecyProperties. In this way it would be possible to provide binding for some of the objects. For example for SphereNode it would be possible to have Radius, CenterPosition and Material as DepandencyProperty. But in this case getting and setting the Radius value would be significantly slower for all users than in the current solution when getters and setters are standard properties.

What is more, each MVVM user may requred different kind of binding.

Therefore I would recommend you to create your own classes that would support binding in a way thar you desire. Those classes would then cresate and upate the Abd.SharpEngine's SceneNode objects.
Andrej Benedik
  


Forum Jump:


Users browsing this thread:
1 Guest(s)