public override void OnApplyTemplate() { base.OnApplyTemplate(); if (Template != null) { openGLControl = Template.FindName("Viewport_3D", this) as OpenGLControl; hwndHostElement = Template.FindName("Ether_Viewport", this) as Control_Ether_HwndHost; sceneWindow = Template.FindName("SceneWindow", this) as Grid; //TODO: Reference by name if (CommandArguments.TryGetArgument("ether")) { sceneWindow.Children.RemoveAt(1); return; } sceneWindow.Children.RemoveAt(2); CompositionTarget.Rendering += (sender, args) => openGLControl.DoRender(); shaderErrorLabel = Template.FindName("Shader_Compiler_Error", this) as TextBlock; Hierarchy.FocusChangedEvent += o => cameraFocusPoint = o.Transform.Position; } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); if (Template != null) { hwndHostElement = Template.FindName("HwndHostElement", this) as Border; Loaded += (sender, args) => InitEther(); SizeChanged += OnSizeChanged; instance = this; } }