Beispiel #1
0
        private void OnWindowMoving(object sender, WindowMoverMovingEventArgs e)
        {
            DockState dockability = DetermineDockability(
                new Rect(e.NewPosition, _parent.ActualSize()), _snapDistance);

            e.NewPosition = CalculateParentDockedPosition(dockability, e.NewPosition);
        }
Beispiel #2
0
        /// <summary>
        /// Gets invoked while the window is being moved to report new window position and give
        /// event listeners or deriving classes to cancel the move or adjust the window position.
        /// Deriving class must ensure to call the base implementation of this function to
        /// ensure correct operation of the window mover object
        /// </summary>
        /// <param name="newPosition"></param>
        /// <returns></returns>
        protected virtual bool OnMoving(ref Point newPosition)
        {
            if (Moving == null)
            {
                return(true);
            }

            var eventArgs = new WindowMoverMovingEventArgs(newPosition);

            Moving(this, eventArgs);

            newPosition = eventArgs.NewPosition;

            return(!eventArgs.IsMoveCancelled);
        }
Beispiel #3
0
        private void OnWindowMoving( object sender, WindowMoverMovingEventArgs e )
        {
            DockState dockability = DetermineDockability(
                        new Rect( e.NewPosition, _parent.ActualSize() ), _snapDistance );

            e.NewPosition = CalculateParentDockedPosition( dockability, e.NewPosition );
        }
Beispiel #4
0
        /// <summary>
        /// Gets invoked while the window is being moved to report new window position and give
        /// event listeners or deriving classes to cancel the move or adjust the window position.
        /// Deriving class must ensure to call the base implementation of this function to 
        /// ensure correct operation of the window mover object
        /// </summary>
        /// <param name="newPosition"></param>
        /// <returns></returns>
        protected virtual bool OnMoving( ref Point newPosition )
        {
            if( Moving == null ) return true;

            var eventArgs = new WindowMoverMovingEventArgs( newPosition );

            Moving( this, eventArgs );

            newPosition = eventArgs.NewPosition;

            return !eventArgs.IsMoveCancelled;
        }