Exemplo n.º 1
0
        /// <summary>
        /// Captures the mouse within the specified input element.
        /// </summary>
        /// <param name="view">The view for which to set mouse capture.</param>
        /// <param name="element">The element to capture the mouse.</param>
        /// <param name="mode">The mouse capture mode.</param>
        /// <returns><see langword="true"/> if the mouse was successfully captured; otherwise, <see langword="false"/>.</returns>
        public static Boolean Capture(PresentationFoundationView view, IInputElement element, CaptureMode mode)
        {
            Contract.Require(view, nameof(view));

            if (element != null)
            {
                return view.CaptureMouse(element, mode);
            }
            else
            {
                view.ReleaseMouse();
                return true;
            }
        }