void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.thisControl = ((HelixToolkit.AnaglyphView3D)(target)); return; case 2: this.LeftPanel = ((System.Windows.Controls.Grid)(target)); return; case 3: this.LeftView = ((System.Windows.Controls.Viewport3D)(target)); return; case 4: this.RightPanel = ((System.Windows.Controls.Grid)(target)); return; case 5: this.AnaglyphEffect1 = ((HelixToolkit.AnaglyphEffect)(target)); return; case 6: this.RightView = ((System.Windows.Controls.Viewport3D)(target)); return; case 7: this.CameraControl = ((HelixToolkit.CameraController)(target)); return; } this._contentLoaded = true; }
public override void OnApplyTemplate() { if (_cameraController == null) { _cameraController = Template.FindName(partCameraControl, this) as CameraController; if (_cameraController != null) _cameraController.Viewport = this.Content as Viewport3D; } base.OnApplyTemplate(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.thisControl = ((HelixToolkit.WiggleView3D)(target)); return; case 2: this.View1 = ((System.Windows.Controls.Viewport3D)(target)); return; case 3: this.CameraControl1 = ((HelixToolkit.CameraController)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.thisControl = ((HelixToolkit.WiggleView3D)(target)); return; case 2: this.View1 = ((System.Windows.Controls.Viewport3D)(target)); return; case 3: this.CameraControl1 = ((HelixToolkit.CameraController)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.thisControl = ((HelixToolkit.AnaglyphView3D)(target)); return; case 2: this.LeftPanel = ((System.Windows.Controls.Grid)(target)); return; case 3: this.LeftView = ((System.Windows.Controls.Viewport3D)(target)); return; case 4: this.RightPanel = ((System.Windows.Controls.Grid)(target)); return; case 5: this.AnaglyphEffect1 = ((HelixToolkit.AnaglyphEffect)(target)); return; case 6: this.RightView = ((System.Windows.Controls.Viewport3D)(target)); return; case 7: this.CameraControl = ((HelixToolkit.CameraController)(target)); return; } this._contentLoaded = true; }
public override void OnApplyTemplate() { if (adornerLayer == null) { adornerLayer = Template.FindName(PART_ADORNER_LAYER, this) as AdornerDecorator; if (adornerLayer != null) adornerLayer.Child = viewport; } Debug.Assert(adornerLayer != null, String.Format("{0} is missing from the template.", PART_ADORNER_LAYER)); if (cameraController == null) { cameraController = Template.FindName(PART_CAMERA_CONTROLLER, this) as CameraController; if (cameraController != null) { cameraController.Viewport = Viewport; cameraController.SelectionChanged += CameraControllerSelectionChanged; } } Debug.Assert(cameraController != null, String.Format("{0} is missing from the template.", PART_CAMERA_CONTROLLER)); if (coordinateView == null) { coordinateView = Template.FindName(PART_COORDINATE_VIEW, this) as Viewport3D; coordinateSystemLights = new Model3DGroup(); coordinateSystemLights.Children.Add(new DirectionalLight(Colors.White, new Vector3D(1, 1, 1))); coordinateSystemLights.Children.Add(new AmbientLight(Colors.DarkGray)); if (coordinateView != null) { coordinateView.Camera = new PerspectiveCamera(); coordinateView.Children.Add(new ModelVisual3D { Content = coordinateSystemLights }); } } Debug.Assert(coordinateView != null, String.Format("{0} is missing from the template.", PART_COORDINATE_VIEW)); if (viewCubeView == null) { viewCubeView = Template.FindName(PART_VIEW_CUBE_VIEW, this) as Viewport3D; viewCubeLights = new Model3DGroup(); // _viewCubeLights.Children.Add(new DirectionalLight(Colors.White, new Vector3D(1, 1, 1))); viewCubeLights.Children.Add(new AmbientLight(Colors.White)); if (viewCubeView != null) { viewCubeView.Camera = new PerspectiveCamera(); viewCubeView.Children.Add(new ModelVisual3D { Content = viewCubeLights }); viewCubeView.MouseEnter += ViewCubeViewMouseEnter; viewCubeView.MouseLeave += ViewCubeViewMouseLeave; } viewCube = Template.FindName(PART_VIEW_CUBE, this) as ViewCubeVisual3D; if (viewCube != null) viewCube.Viewport = Viewport; } Debug.Assert(coordinateView != null, String.Format("{0} is missing from the template.", PART_COORDINATE_VIEW)); // update the coordinateview camera OnCameraChanged(); // add the default headlight OnHeadlightChanged(); base.OnApplyTemplate(); }