34 lines
1.9 KiB
VB.net
34 lines
1.9 KiB
VB.net
Public Class PartPageV
|
|
|
|
Public Sub ItemsControl_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
|
|
Dim ListControl As ListBox=DirectCast(sender,listbox)
|
|
If Not IsNothing( ListControl.SelectedItem) Then
|
|
Dim SelectedItemIndex As Integer = ListControl.Items.IndexOf(ListControl.SelectedItem)
|
|
If SelectedItemIndex < 0 Then Return
|
|
ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
|
|
ListControl.UpdateLayout()
|
|
If ListControl.SelectedItem IsNot Nothing Then
|
|
ListControl.ScrollIntoView(ListControl.SelectedItem)
|
|
End If
|
|
End Sub, Action))
|
|
If SelectedItemIndex > 0 Then
|
|
ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
|
|
ListControl.UpdateLayout()
|
|
ListControl.ScrollIntoView(ListControl.Items(SelectedItemIndex - 1))
|
|
End Sub, Action))
|
|
End If
|
|
If SelectedItemIndex < ListControl.Items.Count - 2 Then
|
|
ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
|
|
ListControl.UpdateLayout()
|
|
ListControl.ScrollIntoView(ListControl.Items(SelectedItemIndex + 1))
|
|
End Sub, Action))
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub UserControl_IsEnabledChanged(sender As Object, e As DependencyPropertyChangedEventArgs)
|
|
|
|
End Sub
|
|
End Class
|