How to use EventManager3D in DXEngine
#1
I am very impressed with the performance of the DXEngine - it significantly improved the performance of my application that uses WPF 3D with Ab3d.PowerToys.

But I have problems with EventManager3D - when I enable the DXEngine the mouse events on my 3D objects stop working.
#2
By default the EventManager3D subscribes to mouse events on the Viewport3D control.

The problem with using EventManager3D inside DXEngine is that the Viewport3D control is not actually shown - it is just a placeholder for 3D scene objects. Because it is not show (IsVisible == false), WPF does not send any mouse or touch events to the control.

The code inside EventManager3D can detect when it is running inside DXEngine and in this case subscribes to events on the parent DXViewportView. But if the EventManager3D is created before Viewport3D is added to DXViewportView, then this is not possible.

In this case you need to set the CustomEventsSourceElement property on EventManager3D and specify the FrameworkElement that will be used to subscribe events.

This is also done in the EventManagerDragSample sample that comes with Ab3d.DXEngine - the code here is the following:

Code:
_eventManager = new Ab3d.Utilities.EventManager3D(Viewport3D1);
_eventManager.CustomEventsSourceElement = ViewportBorder;
Andrej Benedik
  


Forum Jump:


Users browsing this thread:
1 Guest(s)