C# Class ControlzEx.KeyboardNavigationEx

Helper class for a common focusing problem. The focus itself isn't the problem. If we use the common focusing methods the control get the focus but it doesn't get the focus visual style. The KeyboardNavigation class handles the visual style only if the control get the focus from a keyboard device or if the SystemParameters.KeyboardCues is true.
Mostra file Open project: ControlzEx/ControlzEx Class Usage Examples

Public Properties

Property Type Description
AlwaysShowFocusVisualProperty System.Windows.DependencyProperty

Private Properties

Property Type Description
AlwaysShowFocusVisualPropertyChangedCallback void
FrameworkElementGotFocus void
GetAlwaysShowFocusVisual bool
KeyboardNavigationEx System
ShowFocusVisualInternal void

Public Methods

Method Description
Focus ( UIElement element ) : void

Focuses the specified element and shows the focus visual style.

SetAlwaysShowFocusVisual ( UIElement element, bool value ) : void

Sets a the value which indicates if the UI element always show the focus visual style.

Private Methods

Method Description
AlwaysShowFocusVisualPropertyChangedCallback ( DependencyObject dependencyObject, System.Windows.DependencyPropertyChangedEventArgs args ) : void
FrameworkElementGotFocus ( object sender, RoutedEventArgs e ) : void
GetAlwaysShowFocusVisual ( UIElement element ) : bool
KeyboardNavigationEx ( ) : System
ShowFocusVisualInternal ( ) : void

Shows the focus visual of the current focused UI element. Works only together with AlwaysShowFocusVisual property.

Method Details

Focus() public static method

Focuses the specified element and shows the focus visual style.
public static Focus ( UIElement element ) : void
element System.Windows.UIElement The element which will be focused.
return void

SetAlwaysShowFocusVisual() public static method

Sets a the value which indicates if the UI element always show the focus visual style.
public static SetAlwaysShowFocusVisual ( UIElement element, bool value ) : void
element System.Windows.UIElement
value bool
return void

Property Details

AlwaysShowFocusVisualProperty public_oe static_oe property

Attached DependencyProperty for setting AlwaysShowFocusVisual for a UI element.
public static DependencyProperty,System.Windows AlwaysShowFocusVisualProperty
return System.Windows.DependencyProperty