Event handler
Hi everybody,
I created an Eventmanager 3d with a visualeventsource3d and added an handler on a 3dview.MouseLeftButtonDown.
If i click on a object the eventhandler give control to the visualevent and everything is ok. But i need to raise the event also when is clicked a empy part of the 3dview.

Is it possible?
Thanks for reply
Any suggestion??
With EventManager3D you will be only able to get events when mouse is over the subscribed 3D objects.

To get mouse events when over the empty area, you will need to use manually hit testing instead of using EventManager3D. To do this, you will need to subscribe to mouse events on a Border or any other parent object from Viewport3D (if you subscribe to mouse events on Viewport3D, you will only get them when mouse is over any 3D object). The parent Border or other parent object need to have the Background property set (it can be set to Transparent). If the Background property is not set, then this area is not "occupied" by the Border or any other object.

When you are subscribed to mouse events, then check the "Standard WPF hit testing sample" that comes with Ab3d.PowerToys samples (EventManager3D\StandardWpfHitTestingDemo.xaml.cs) to see how to get hit 3D objects.

Note that if you will want to use the same mouse events for hit testing and for camera rotation and movement (for MouseCameraController), you will need to subscribe to PreviewMouse... events (so PreviewMouseDown instead of MouseDown). See the MouseSelectionAndRotation for more info about that.
Andrej Benedik
Many Thanks!

Forum Jump:

Users browsing this thread:
1 Guest(s)