Back to Devexpress

WinExplorerView.ItemKeyDown Event

windowsforms-devexpress-dot-xtragrid-dot-views-dot-winexplorer-dot-winexplorerview-bd78a77a.md

latest2.8 KB
Original Source

WinExplorerView.ItemKeyDown Event

Occurs when an end-user presses any keyboard key, while an item within this WinExplorerView is selected.

Namespace : DevExpress.XtraGrid.Views.WinExplorer

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Action")]
public event WinExplorerViewItemKeyDownEventHandler ItemKeyDown
vb
<DXCategory("Action")>
Public Event ItemKeyDown As WinExplorerViewItemKeyDownEventHandler

Event Data

The ItemKeyDown event's data class is DevExpress.XtraGrid.Views.WinExplorer.WinExplorerViewItemKeyEventArgs.

Remarks

The ItemKeyDown event is raised whenever an end-user clicks any keyboard key if the WinExplorerView currently has a selected item (items). This also applies to keys used for navigation within the WinExplorerView (arrow keys, Page Up, Home, End etc.). Handle this event to get detailed information about the pressed key and perform specific actions depending on the key. The following code illustrates how to bind the WinExplorerView.MoveFirst and WinExplorerView.MoveLast methods to specific keyboard keys.

csharp
private void winExplorerView1_ItemKeyDown(object sender, WinExplorerViewItemKeyEventArgs e) {
    if (e.KeyInfo.KeyData == Keys.L) winExplorerView1.MoveLast();
    if (e.KeyInfo.KeyData == Keys.F) winExplorerView1.MoveFirst();
}
vb
Private Sub winExplorerView1_ItemKeyDown(sender As Object, e As WinExplorerViewItemKeyEventArgs)
    If e.KeyInfo.KeyData = Keys.L Then
        winExplorerView1.MoveLast()
    End If
    If e.KeyInfo.KeyData = Keys.F Then
        winExplorerView1.MoveFirst()
    End If
End Sub

See Also

WinExplorerView Class

WinExplorerView Members

DevExpress.XtraGrid.Views.WinExplorer Namespace