// adds to boardUI and then perform the required bindings
        protected internal virtual void AddToBoardUI(BoardUI <TBoard> boardUI)
        {
            // automatically adds to the boardUI and do the necessary event bindings
            // defensive programming required since I used default parameters

            if (BoardUI != null)
            {
                RemoveFromBoardUI();
            }

            SetBoardUIDirectly(boardUI);

            if (BoardUI != null)
            {
                BoardUI.Children.Add(this);

                // set the position and size of the UI object right at the start
                ResizingRelocationBind(this, new BoardUIResizeEventArgs(new Size(BoardUI.ActualWidth, BoardUI.ActualHeight), BoardUI.Board.Columns, BoardUI.Board.Rows));

                // binding of display size change
                BoardUI.BoardUIResize += ResizingRelocationBind;

                // IMPORTANT
                // binding of movement
                Logic.PositionChanged += PositionBind;
            }
        }
 // adds to boardUI and then perform the required bindings
 protected internal override void AddToBoardUI(BoardUI <TBoard> boardUI)
 {
     // make sure base AddToBoardUI is called first to set up the properties
     base.AddToBoardUI(boardUI);
     // performs other bindings
     if (BoardUI != null)
     {
         boardUI.Board.BoardKeyDown += PerformKey;
     }
 }
        // adds to boardUI and then perform the required bindings
        protected internal override void AddToBoardUI(BoardUI <TBoard> boardUI)
        {
            // make sure base AddToBoardUI is called first to set up the properties
            base.AddToBoardUI(boardUI);
            // performs tweening

            if (BoardUI != null)
            {
                BoardUI.Board.BoardTick += PerformTween;
            }
        }
        protected internal PositionalUI(Positional <TBoard> positional, Image imageToDisplay, BoardUI <TBoard> boardUI = null)
        {
            // set the resizing mode to high quality so that the UI looks nicer
            SetValue(RenderOptions.BitmapScalingModeProperty, BitmapScalingMode.HighQuality);
            // set stretch mode to fill
            Stretch = System.Windows.Media.Stretch.Fill;

            Logic          = positional;
            ImageToDisplay = imageToDisplay;

            BoardUI = boardUI;

            // set this.Source to bind to ImageToDisplay.Source
            InitializeBindings();
        }
 // do not attempt to use this if possible
 protected internal void SetBoardUIDirectly(BoardUI <TBoard> boardUI)
 {
     this.boardUI = boardUI;
 }
        internal protected MovableAnimatedUI(TMovable movable, TMovableAnimatedImage imageToDisplay, BoardUI <TBoard> boardUI) :
            base(movable, imageToDisplay, boardUI)
        {
            Debug.WriteLine("Constructor called MovableAnimated");

            if (boardUI != null)
            {
                //boardUI.RemovePosUI += RemoveSelf;
            }

            Logic.Colliding += HandleCollision;
        }
 // adds to boardUI and then perform the required bindings
 protected internal override void AddToBoardUI(BoardUI <TBoard> boardUI)
 {
     // make sure base AddToBoardUI is called first to set up the properties
     base.AddToBoardUI(boardUI);
     // performs other bindings
 }
 internal protected PositionalAnimatedUI(TPositional positional, TAnimatedImage imageToDisplay, BoardUI <TBoard> boardUI) :
     base(positional, imageToDisplay, boardUI)
 {
     if (boardUI != null)
     {
         boardUI.Board.BoardTick += PerformTween;
         //boardUI.RemovePosUI += RemoveSelf;
     }
 }
 internal protected ControllableAnimatedUI(TControllable controllable, TControllableAnimatedImage imageToDisplay, BoardUI <TBoard> boardUI) :
     base(controllable, imageToDisplay, boardUI)
 {
     Debug.WriteLine("Constructor called");
     if (boardUI != null)
     {
         boardUI.Board.BoardKeyDown += PerformKey;
         //boardUI.RemovePosUI += RemoveSelf;
     }
 }