Viewport3D.MouseLeftButtonDown is not working

May 27, 2009 at 2:58 AM

Hello everyone, 

I have tried the KIT3D for creating the cube, and I have tried the HitTest demo. But in the demo, the MouseLeftButtonDown is attached to the LayoutRoot. I have tried to attached the MouseLeftButtonDown event handler to the viewport, but it is not responding. 

Is this the default behaviour of viewport or i'm missing something? 


this is my Code

Public void CreateCube



                _viewport = new Viewport3D();

                _viewport.HorizontalAlignment = HorizontalAlignment.Stretch;

                _viewport.VerticalAlignment = VerticalAlignment.Stretch;

                _viewport.Camera = new PerspectiveCamera(new Point3D(4, 4, 25),

                                                        new Vector3D(0, 0, -1),

                                                        new Vector3D(0, 1, 0),


                _modelVisual = LoadCubes();


                _viewport.VPHeight = 500;

                _viewport.VPWidth = 500;

                _viewport.Background = new SolidColorBrush(Colors.Red);

                _viewport.MouseLeftButtonDown += new MouseButtonEventHandler(viewport_MouseLeftButtonDown);



But when I click the viewport, the 'viewport_MouseLeftButtonDown' is not called.

Can anyone give me some information about this?

Thank you