TouchDevice.Captured Property

Definition

Gets the element that captured the TouchDevice.

C#
public System.Windows.IInputElement Captured { get; }

Property Value

The element that captured the TouchDevice.

Examples

The following example handles the TouchUp events that occur on a Canvas. It checks the Captured property to verify that the device that raised the event is captured to the Canvas. If it is, the TouchDevice is released.

This example is part of a larger example that is available in the TouchDevice class overview.

C#
private void canvas_TouchUp(object sender, TouchEventArgs e)
{
    Canvas _canvas = (Canvas)sender as Canvas;
    if (_canvas != null && e.TouchDevice.Captured == _canvas)
    {
        _canvas.ReleaseTouchCapture(e.TouchDevice);
    }
}

Applies to

Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10