Volume Control
Application-specific hotkeys for Windows
VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior Class Reference

Removes logical and/or keyboard focus from the attached control when the Escape key is pressed. More...

Inheritance diagram for VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior:
Collaboration diagram for VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior:

Static Public Attributes

static readonly DependencyProperty FocusOnProperty
 The DependencyProperty for FocusOn. More...
 
static readonly DependencyProperty FocusOnParentWindowProperty
 The DependencyProperty for FocusOnParentWindow. More...
 
static readonly DependencyProperty AffectsKeyboardFocusProperty
 The DependencyProperty for AffectsKeyboardFocus. More...
 
static readonly DependencyProperty AffectsLogicalFocusProperty
 The DependencyProperty for AffectsLogicalFocus. More...
 
static readonly DependencyProperty SetEventAsHandledProperty
 The DependencyProperty for SetEventAsHandled. More...
 

Protected Member Functions

override void OnAttached ()
 
override void OnDetaching ()
 

Properties

Control?? FocusOn [get, set]
 Gets or sets the Control that will be focused. More...
 
bool FocusOnParentWindow [get, set]
 Gets or sets whether the focus will be set to the parent Window or cleared entirely. More...
 
bool AffectsKeyboardFocus [get, set]
 Gets or sets whether the Keyboard focus is changed when the escape key is pressed. More...
 
bool AffectsLogicalFocus [get, set]
 Gets or sets whether the Logical focus is changed when the escape key is pressed. More...
 
bool SetEventAsHandled [get, set]
 Gets or sets whether PreviewKeyDown events for the Escape key are set as Handled. More...
 

Detailed Description

Removes logical and/or keyboard focus from the attached control when the Escape key is pressed.

By default, the logical and keyboard focus are set to the Window that owns the attached control.

Member Data Documentation

◆ AffectsKeyboardFocusProperty

readonly DependencyProperty VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior.AffectsKeyboardFocusProperty
static
Initial value:
= DependencyProperty.Register(
typeof(bool),
typeof(EscapeRemovesFocusBehavior),
new PropertyMetadata(true, OnAffectsKeyboardFocusPropertyChanged))
bool AffectsKeyboardFocus
Gets or sets whether the Keyboard focus is changed when the escape key is pressed.
Definition: EscapeRemovesFocusBehavior.cs:80

The DependencyProperty for AffectsKeyboardFocus.

◆ AffectsLogicalFocusProperty

readonly DependencyProperty VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior.AffectsLogicalFocusProperty
static
Initial value:
= DependencyProperty.Register(
typeof(bool),
typeof(EscapeRemovesFocusBehavior),
new PropertyMetadata(true, OnAffectsLogicalFocusPropertyChanged))
bool AffectsLogicalFocus
Gets or sets whether the Logical focus is changed when the escape key is pressed.
Definition: EscapeRemovesFocusBehavior.cs:116

The DependencyProperty for AffectsLogicalFocus.

◆ FocusOnParentWindowProperty

readonly DependencyProperty VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior.FocusOnParentWindowProperty
static
Initial value:
= DependencyProperty.Register(
typeof(bool),
typeof(EscapeRemovesFocusBehavior),
new PropertyMetadata(true))
bool FocusOnParentWindow
Gets or sets whether the focus will be set to the parent Window or cleared entirely.
Definition: EscapeRemovesFocusBehavior.cs:58

The DependencyProperty for FocusOnParentWindow.

◆ FocusOnProperty

readonly DependencyProperty VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior.FocusOnProperty
static
Initial value:
= DependencyProperty.Register(
nameof(FocusOn),
typeof(Control),
typeof(EscapeRemovesFocusBehavior),
new PropertyMetadata(null))
Control?? FocusOn
Gets or sets the Control that will be focused.
Definition: EscapeRemovesFocusBehavior.cs:36

The DependencyProperty for FocusOn.

◆ SetEventAsHandledProperty

readonly DependencyProperty VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior.SetEventAsHandledProperty
static
Initial value:
= DependencyProperty.Register(
typeof(bool),
typeof(EscapeRemovesFocusBehavior),
new PropertyMetadata(true))
bool SetEventAsHandled
Gets or sets whether PreviewKeyDown events for the Escape key are set as Handled.
Definition: EscapeRemovesFocusBehavior.cs:155

The DependencyProperty for SetEventAsHandled.

Property Documentation

◆ AffectsKeyboardFocus

bool VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior.AffectsKeyboardFocus
getset

Gets or sets whether the Keyboard focus is changed when the escape key is pressed.

Returns
true when Keyboard.FocusedElement will be changed; otherwise false.

◆ AffectsLogicalFocus

bool VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior.AffectsLogicalFocus
getset

Gets or sets whether the Logical focus is changed when the escape key is pressed.

Returns
true when the FocusManager.FocusedElementProperty will be changed; otherwise false.

◆ FocusOn

Control?? VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior.FocusOn
getset

Gets or sets the Control that will be focused.

When this is set to a non-null value, the FocusOnParentWindow property is ignored.

◆ FocusOnParentWindow

bool VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior.FocusOnParentWindow
getset

Gets or sets whether the focus will be set to the parent Window or cleared entirely.

This property is ignored when FocusOn is set to a non-null value.

◆ SetEventAsHandled

bool VolumeControl.WPF.Behaviors.EscapeRemovesFocusBehavior.SetEventAsHandled
getset

Gets or sets whether PreviewKeyDown events for the Escape key are set as Handled.

PreviewKeyDown events where the KeyEventArgs.Key is not Key.Escape are never set as handled under any circumstances.

Returns
true when events are set as Handled; otherwise false when events are not set as handled.

The documentation for this class was generated from the following file: