1
votes

In my WPF project i've a listview, on pressing down key on the last item the focus has been shifted to the down button of the vertical scrollbar, which is wrong in my case, i want to ignore the keydown event on the last item so when user press up button it will jump to the 2nd last item inside listview.

i've tried by putting below code inside lvTender_PreviewKeyDown + lvTender_KeyDown, the code is executing on the last item keydown but the event is not cancelling.

If e.Key = Key.Down Then If _selectedIndex + 1 = Me.lvTender.Items.Count Then e.Handled = False End If End If

please help

1

1 Answers

1
votes

You need to do e.Handled = true to stop the event shain

If e.Key = Key.Down AndAlso _selectedIndex + 1 = Me.lvTender.Items.Count Then e.Handled = True End If