示例#1
0
        private static void GameTreeVMChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            GameTreeControl GameTreeControl = d as GameTreeControl;

            if (GameTreeControl != null)
            {
                GameTreeViewModel viewModel = (GameTreeViewModel)e.NewValue;
                viewModel.GameTreeRedrawRequested += GameTreeControl.GameTreeRedrawRequsted;

                // GameTree scrolling
                GameTreeControl.gameTreeRoot.PointerEntered      += GameTreeControl.GameTreeControl_PointerEntered;
                GameTreeControl.gameTreeRoot.PointerExited       += GameTreeControl.GameTreeControl_PointerExited;
                GameTreeControl.gameTreeRoot.PointerWheelChanged += GameTreeControl.GameTreeControl_PointerWheelChanged;

                // Arrows handling
                // This control has public methods to navigate using arrow keys.
                // These methods are being called by owning view.

                // Drawing
                GameTreeControl.canvas.Draw += GameTreeControl.Canvas_Draw;
                // GameTree scrolling and node highlighting
                GameTreeControl.canvas.PointerReleased += GameTreeControl.Canvas_PointerReleased;
                GameTreeControl.canvas.PointerMoved    += GameTreeControl.Canvas_PointerMoved;
                GameTreeControl.canvas.PointerPressed  += GameTreeControl.Canvas_PointerPressed;

                // Relaculate desired GameTree size and redraw
                GameTreeControl.UpdateGameTreeSize();
                GameTreeControl.canvas.Invalidate();
            }
        }
示例#2
0
        private static void GameTreeRenderPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            GameTreeControl GameTreeControl = d as GameTreeControl;

            if (GameTreeControl != null)
            {
                GameTreeControl.canvas.Invalidate();
            }
        }