PointHitTestResult.VisualHit Proprietà

Definizione

Ottiene l'oggetto visivo restituito dal risultato di un hit test.

public:
 property System::Windows::Media::Visual ^ VisualHit { System::Windows::Media::Visual ^ get(); };
public System.Windows.Media.Visual VisualHit { get; }
member this.VisualHit : System.Windows.Media.Visual
Public ReadOnly Property VisualHit As Visual

Valore della proprietà

Visual

Oggetto Visual che rappresenta il risultato dell'hit test.

Esempio

Nell'esempio seguente viene illustrato come accedere alla VisualHit proprietà in una funzione di callback dei risultati di hit test.

// Return the result of the hit test to the callback.
public HitTestResultBehavior MyHitTestResult(HitTestResult result)
{
    // Add the hit test result to the list that will be processed after the enumeration.
    hitResultsList.Add(result.VisualHit);

    // Set the behavior to return visuals at all z-order levels.
    return HitTestResultBehavior.Continue;
}
' Return the result of the hit test to the callback.
Public Function MyHitTestResult(ByVal result As HitTestResult) As HitTestResultBehavior
    ' Add the hit test result to the list that will be processed after the enumeration.
    hitResultsList.Add(result.VisualHit)

    ' Set the behavior to return visuals at all z-order levels.
    Return HitTestResultBehavior.Continue
End Function

Commenti

Il VisualHit valore potrebbe rappresentare potenzialmente più oggetti visivi durante un singolo hit test. Il metodo di callback dell'hit test definisce le azioni eseguite quando viene identificato un hit test su un determinato oggetto visivo nella struttura ad albero visuale. Dopo aver eseguito le azioni, viene restituito un HitTestResultBehavior valore che determina se continuare l'enumerazione di qualsiasi altro oggetto visivo. L'ordine di enumerazione degli oggetti visivi restituiti è in base all'ordine z nel piano di rendering.

Si applica a