TouchDevice.Capture Metodo

Definizione

Acquisisce un tocco all'elemento specificato.

Overload

Nome Descrizione
Capture(IInputElement)

Acquisisce un tocco all'elemento specificato usando la Element modalità di acquisizione.

Capture(IInputElement, CaptureMode)

Acquisisce un tocco all'elemento specificato utilizzando l'oggetto specificato CaptureMode.

Capture(IInputElement)

Acquisisce un tocco all'elemento specificato usando la Element modalità di acquisizione.

public:
 bool Capture(System::Windows::IInputElement ^ element);
public bool Capture(System.Windows.IInputElement element);
member this.Capture : System.Windows.IInputElement -> bool
Public Function Capture (element As IInputElement) As Boolean

Parametri

element
IInputElement

Elemento che acquisisce l'input tocco.

Valori restituiti

true se l'elemento è stato in grado di acquisire il tocco; in caso contrario, false.

Eccezioni

element non è un UIElementoggetto , UIElement3Do ContentElement.

Esempio

Nell'esempio seguente vengono gestiti gli TouchDown eventi che si verificano in un oggetto Canvas. Quando si preme un tocco su Canvas, l'oggetto TouchDevice viene acquisito in Canvas.

Questo esempio fa parte di un esempio più ampio disponibile nella panoramica della TouchDevice classe.

private void canvas_TouchDown(object sender, TouchEventArgs e)
{
    Canvas _canvas = (Canvas)sender as Canvas;
    if (_canvas != null)
    {
        _canvas.Children.Clear();
        e.TouchDevice.Capture(_canvas);

        // Record the ID of the first touch point if it hasn't been recorded.
        if (firstTouchId == -1)
            firstTouchId = e.TouchDevice.Id;
    }
}
' Touch Down
Private Sub canvas_TouchDown(ByVal sender As System.Object, ByVal e As System.Windows.Input.TouchEventArgs)
    Dim _canvas As Canvas = CType(sender, Canvas)
    If (_canvas IsNot Nothing) Then
        _canvas.Children.Clear()
        e.TouchDevice.Capture(_canvas)

        ' Record the ID of the first touch point if it hasn't been recorded.
        If firstTouchId = -1 Then
            firstTouchId = e.TouchDevice.Id
        End If
    End If
End Sub

Commenti

Un TouchDevice oggetto non può essere acquisito in un elemento se è già stato acquisito in un altro elemento.

Si applica a

Capture(IInputElement, CaptureMode)

Acquisisce un tocco all'elemento specificato utilizzando l'oggetto specificato CaptureMode.

public:
 bool Capture(System::Windows::IInputElement ^ element, System::Windows::Input::CaptureMode captureMode);
public bool Capture(System.Windows.IInputElement element, System.Windows.Input.CaptureMode captureMode);
member this.Capture : System.Windows.IInputElement * System.Windows.Input.CaptureMode -> bool
Public Function Capture (element As IInputElement, captureMode As CaptureMode) As Boolean

Parametri

element
IInputElement

Elemento che acquisisce il tocco.

captureMode
CaptureMode

Criteri di acquisizione da usare.

Valori restituiti

true se l'elemento è stato in grado di acquisire il tocco; in caso contrario, false.

Eccezioni

element non è un UIElementoggetto , UIElement3Do ContentElement.

Commenti

Un TouchDevice oggetto non può essere acquisito in un elemento se è già stato acquisito in un altro elemento.

Si applica a