Keyboard 클래스

정의

키보드 디바이스를 나타냅니다.

public ref class Keyboard abstract sealed
public static class Keyboard
type Keyboard = class
Public Class Keyboard
상속
Keyboard

예제

다음 예제에서는 사용 하는 방법의 IsKeyToggled 키 전환 된 상태에서 인지 확인 하는 방법입니다. 경우는 Key 전달할 IsKeyToggled 는 설정/해제할 단추의 배경이 변경 됩니다.

// 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

설명

Keyboard 키보드 관련 이벤트, 메서드 및 속성 키보드의 상태에 대 한 정보를 제공 하는 클래스를 제공 합니다.

각 이벤트는 Keyboard 정의 연결된 된 이벤트는 기본 요소 클래스에 의해 다시 노출 UIElementContentElement 새 라우트된 이벤트로 합니다. 일반적으로 것에서 애플리케이션에 대 한 키보드 이벤트를 처리 하는 편리한 UIElementContentElement를 사용 하는 대신는 Keyboard 이벤트입니다. 자세한 내용은 참조 하세요 입력 개요합니다.

키보드 입력을 수신 하는 요소에 대 한 순서 대로 요소가 포커스를 받을 수 있어야 합니다. 대부분의 UIElement 파생된 개체는 기본적으로 포커스를 받을 수 있습니다. 그렇지 않으면 요소에 포커스를 설정 합니다 Focusable 속성을 기본 요소의 true합니다. 기본 요소에 대 한 자세한 내용은 참조 하세요. 기본 요소 개요합니다.

Panel 클래스와 같은 StackPanel 하 고 Canvas의 기본값을 설정 Focusablefalse입니다. 키보드 포커스를 받으려면 이러한 개체에 대 한 따라서 Focusable 으로 설정 되어 있어야 true합니다.

키보드 포커스는 키보드 입력을 수신 하는 개체를 참조 합니다. 키보드 포커스가 있는 요소가 IsKeyboardFocusedtrue합니다. 전체 바탕 화면에 키보드 포커스가 있는 요소가 하나만 있을 수 있습니다. 논리 포커스는 포커스가 있는 포커스 범위 내에서 개체를 가리킵니다. 포커스, 키보드 포커스와 논리 포커스가에 대 한 자세한 내용은 참조 하세요. 입력 개요 하 고 포커스 개요합니다.

정적 멤버를 Keyboard 주 클래스 대리자 KeyboardDevice 스레드의 호출 되므로 반드시 스레드로부터 안전 하지 않습니다.

필드

GotKeyboardFocusEvent

GotKeyboardFocus 연결된 이벤트를 식별합니다.

KeyboardInputProviderAcquireFocusEvent

KeyboardInputProviderAcquireFocus 연결된 이벤트를 식별합니다.

KeyDownEvent

KeyDown 연결된 이벤트를 식별합니다.

KeyUpEvent

KeyUp 연결된 이벤트를 식별합니다.

LostKeyboardFocusEvent

LostKeyboardFocus 연결된 이벤트를 식별합니다.

PreviewGotKeyboardFocusEvent

PreviewGotKeyboardFocus 연결된 이벤트를 식별합니다.

PreviewKeyboardInputProviderAcquireFocusEvent

PreviewKeyboardInputProviderAcquireFocus 연결된 이벤트를 식별합니다.

PreviewKeyDownEvent

PreviewKeyDown 연결된 이벤트를 식별합니다.

PreviewKeyUpEvent

PreviewKeyUp 연결된 이벤트를 식별합니다.

PreviewLostKeyboardFocusEvent

PreviewLostKeyboardFocus 연결된 이벤트를 식별합니다.

속성

DefaultRestoreFocusMode

포커스를 복원할 때 WPF(Windows Presentation Foundation)의 동작을 가져오거나 설정합니다.

FocusedElement

키보드 포커스를 갖는 요소를 가져옵니다.

Modifiers

현재 눌러져 있는 ModifierKeys의 집합을 가져옵니다.

PrimaryDevice

기본 키보드 입력 디바이스를 가져옵니다.

메서드

AddGotKeyboardFocusHandler(DependencyObject, KeyboardFocusChangedEventHandler)

GotKeyboardFocus 연결된 이벤트에 대한 처리기를 추가합니다.

AddKeyboardInputProviderAcquireFocusHandler(DependencyObject, KeyboardInputProviderAcquireFocusEventHandler)

KeyboardInputProviderAcquireFocus 연결된 이벤트에 대한 처리기를 추가합니다.

AddKeyDownHandler(DependencyObject, KeyEventHandler)

KeyDown 연결된 이벤트에 대한 처리기를 추가합니다.

AddKeyUpHandler(DependencyObject, KeyEventHandler)

KeyUp 연결된 이벤트에 대한 처리기를 추가합니다.

AddLostKeyboardFocusHandler(DependencyObject, KeyboardFocusChangedEventHandler)

LostKeyboardFocus 연결된 이벤트에 대한 처리기를 추가합니다.

AddPreviewGotKeyboardFocusHandler(DependencyObject, KeyboardFocusChangedEventHandler)

PreviewGotKeyboardFocus 연결된 이벤트에 대한 처리기를 추가합니다.

AddPreviewKeyboardInputProviderAcquireFocusHandler(DependencyObject, KeyboardInputProviderAcquireFocusEventHandler)

PreviewKeyboardInputProviderAcquireFocus 연결된 이벤트에 대한 처리기를 추가합니다.

AddPreviewKeyDownHandler(DependencyObject, KeyEventHandler)

PreviewKeyDown 연결된 이벤트에 대한 처리기를 추가합니다.

AddPreviewKeyUpHandler(DependencyObject, KeyEventHandler)

PreviewKeyUp 연결된 이벤트에 대한 처리기를 추가합니다.

AddPreviewLostKeyboardFocusHandler(DependencyObject, KeyboardFocusChangedEventHandler)

PreviewLostKeyboardFocus 연결된 이벤트에 대한 처리기를 추가합니다.

ClearFocus()

포커스를 지웁니다.

Focus(IInputElement)

지정한 요소에 키보드 포커스를 설정합니다.

GetKeyStates(Key)

지정한 키의 키 상태 집합을 가져옵니다.

IsKeyDown(Key)

지정한 키가 눌러져 있는지 여부를 확인합니다.

IsKeyToggled(Key)

지정한 키가 전환되었는지 여부를 확인합니다.

IsKeyUp(Key)

지정한 키가 놓여 있는지 여부를 확인합니다.

RemoveGotKeyboardFocusHandler(DependencyObject, KeyboardFocusChangedEventHandler)

GotKeyboardFocus 연결된 이벤트에 대한 처리기를 제거합니다.

RemoveKeyboardInputProviderAcquireFocusHandler(DependencyObject, KeyboardInputProviderAcquireFocusEventHandler)

KeyboardInputProviderAcquireFocus 연결된 이벤트에 대한 처리기를 제거합니다.

RemoveKeyDownHandler(DependencyObject, KeyEventHandler)

KeyDown 연결된 이벤트에 대한 처리기를 제거합니다.

RemoveKeyUpHandler(DependencyObject, KeyEventHandler)

KeyUp 연결된 이벤트에 대한 처리기를 제거합니다.

RemoveLostKeyboardFocusHandler(DependencyObject, KeyboardFocusChangedEventHandler)

LostKeyboardFocus 연결된 이벤트에 대한 처리기를 제거합니다.

RemovePreviewGotKeyboardFocusHandler(DependencyObject, KeyboardFocusChangedEventHandler)

PreviewGotKeyboardFocus 연결된 이벤트에 대한 처리기를 제거합니다.

RemovePreviewKeyboardInputProviderAcquireFocusHandler(DependencyObject, KeyboardInputProviderAcquireFocusEventHandler)

PreviewKeyboardInputProviderAcquireFocus 연결된 이벤트에 대한 처리기를 제거합니다.

RemovePreviewKeyDownHandler(DependencyObject, KeyEventHandler)

PreviewKeyDown 연결된 이벤트에 대한 처리기를 제거합니다.

RemovePreviewKeyUpHandler(DependencyObject, KeyEventHandler)

PreviewKeyUp 연결된 이벤트에 대한 처리기를 제거합니다.

RemovePreviewLostKeyboardFocusHandler(DependencyObject, KeyboardFocusChangedEventHandler)

PreviewLostKeyboardFocus 연결된 이벤트에 대한 처리기를 제거합니다.

연결된 이벤트

GotKeyboardFocus

요소가 키보드 포커스를 받으면 발생합니다.

KeyboardInputProviderAcquireFocus

키보드 입력 공급자가 포커스를 가질 때 발생합니다.

KeyDown

키보드의 키를 누르면 발생합니다.

KeyUp

키보드의 키를 놓을 때 발생합니다.

LostKeyboardFocus

요소가 키보드 포커스를 잃으면 발생합니다.

PreviewGotKeyboardFocus

요소가 키보드 포커스를 얻으면 발생합니다.

PreviewKeyboardInputProviderAcquireFocus

키보드 입력 공급자가 포커스를 가져오고 있을 때 발생합니다.

PreviewKeyDown

키보드의 키를 누르면 발생합니다.

PreviewKeyUp

키보드의 키를 놓을 때 발생합니다.

PreviewLostKeyboardFocus

요소가 키보드 포커스를 잃으면 발생합니다.

적용 대상

추가 정보