UIElement.CaptureTouch(TouchDevice) Method

Definition

尝试将触摸屏输入强制捕获到此元素。Attempts to force capture of a touch to this element.

public:
 bool CaptureTouch(System::Windows::Input::TouchDevice ^ touchDevice);
public bool CaptureTouch (System.Windows.Input.TouchDevice touchDevice);
member this.CaptureTouch : System.Windows.Input.TouchDevice -> bool
Public Function CaptureTouch (touchDevice As TouchDevice) As Boolean

Parameters

touchDevice
TouchDevice

要捕获的设备。The device to capture.

Returns

Boolean

如果将指定触摸屏输入捕获到此元素,则为 true ;否则为 falsetrue if the specified touch is captured to this element; otherwise, false.

Exceptions

touchDevicenulltouchDevice is null.

Remarks

如果当前已将 TouchDevice 捕获到另一个元素,CaptureTouch 将返回 falseCaptureTouch will return false if the TouchDevice is currently captured to another element.

如果 CaptureTouch 返回 true,则会引发 GotTouchCapture 事件。If CaptureTouch returns true, then the GotTouchCapture event is raised.

若要从此元素中释放单个触摸的捕获,请使用 ReleaseTouchCapture 方法,并指定要释放的触摸设备。To release capture of a single touch from this element, use the ReleaseTouchCapture method and specify the touch device to release. 若要释放此元素的所有接触,请使用 ReleaseAllTouchCaptures 方法。To release all touches from this element, use the ReleaseAllTouchCaptures method.

Applies to

See also