Taal

Keyboard.IsKeyToggled(Key) Methode

Definitie

Bepaalt of de opgegeven sleutel is ingeschakeld.

public:
 static bool IsKeyToggled(System::Windows::Input::Key key);
public static bool IsKeyToggled(System.Windows.Input.Key key);
static member IsKeyToggled : System.Windows.Input.Key -> bool
Public Shared Function IsKeyToggled (key As Key) As Boolean

Parameters

key
Key

De opgegeven sleutel.

Retouren

trueals key de wisselknop is ingeschakeld, anders. false

Voorbeelden

In het volgende voorbeeld ziet u hoe u de methode gebruikt om de IsKeyToggled status van een specifieke sleutel te bepalen. De Return sleutel wordt doorgegeven aan de IsKeyToggled methode. Als de methode wordt geretourneerd true, wordt de achtergrond van een Button bestand gewijzigd.

// Uses the Keyboard.IsToggled to determine if a key is toggled.
if (Keyboard.IsKeyToggled(Key.Return))
{
    btnIsToggle.Background = Brushes.Red;
}
else
{
    btnIsToggle.Background = Brushes.AliceBlue;
}
' Uses the Keyboard.IsToggled to determine if a key is toggled.
If Keyboard.IsKeyToggled(Key.Return) Then
    btnIsToggle.Background = Brushes.Red
Else
    btnIsToggle.Background = Brushes.AliceBlue
End If

Opmerkingen

De GetKeyStates methode kan worden gebruikt om de set statussen van een specifieke sleutel te bepalen.

Van toepassing op

Zie ook