Class DataGridKeyboardFocusBehavior
Behavior for System.Windows.FrameworkElements that are part of a System.Windows.Controls.DataGrid. It allows to define Keys that lead to keyboard focus of the datagrids first realized System.Windows.Controls.DataGridRow.
Inheritance
Implements
Namespace: Sartorius.SAF.Presentation.Controls.Behaviors
Assembly: Sartorius.SAF.Presentation.Controls.dll
Syntax
public class DataGridKeyboardFocusBehavior : Behavior<FrameworkElement>, IAnimatable, IAttachedObject
Remarks
The default key used is System.Windows.Input.Key.Down. The behavior sets keyboard focus to the first realized data grid row. On a grid with System.Windows.Controls.DataGrid.EnableRowVirtualization this is generally the first visible row. When row virtualization is off the very first row will be focused.
Examples
The following Xaml adds the behavior to the column picker button. When the column picker button has the key focus and the user presses the back button the first realized System.Windows.Controls.DataGridRow.
Fields
View SourceKeyProperty
Identifies the System.Windows.DependencyProperty for Key.
Declaration
public static readonly DependencyProperty KeyProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
Properties
View SourceKey
Gets or sets the Key that leads to keayboardfocus of the first (visible) System.Windows.Controls.DataGridRow.
Declaration
public Key Key { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Input.Key |
Remarks
The default is System.Windows.Input.Key.Down.
Methods
View SourceOnAttached()
Called after the behavior is attached to an AssociatedObject.
Declaration
protected override void OnAttached()
Overrides
Remarks
Override this to hook up functionality to the AssociatedObject.
OnDetaching()
Called when the behavior is being detached from its AssociatedObject, but before it has actually occurred.
Declaration
protected override void OnDetaching()
Overrides
Remarks
Override this to unhook functionality from the AssociatedObject.