The C1TileListBox for WPF provides the functionality to select and deselect Items by default at the RightMouse button's click. This blog explains an approach to select and deselect items at the LeftMouse button's click. To implement the same, we will make use of its MouseLeftButtonUp and PreviewMouseRightButtonDown events.
Private Sub tileListBox_MouseLeftButtonUp(sender As Object, e As MouseButtonEventArgs) Handles tileListBox.MouseLeftButtonUp
Dim index As Integer = tileListBox.GetIndexAt(e.GetPosition(tileListBox))
Dim obj As Item = CType(tileListBox.Items(index), Item)
Dim lst As List(Of Object) = CType(tileListBox.SelectedItems, Object()).ToList()
If Keyboard.IsKeyDown(Key.LeftCtrl) Or Keyboard.IsKeyDown(Key.RightCtrl) Then
lst.Add(obj)
flag = True
Else
lst.Add(obj)
If flag = True Then
lst.Clear()
flag = False
End If
End If
tileListBox.SelectedItems = lst.ToArray()
End Sub
Private Sub tileListBox_PreviewMouseRightButtonDown(sender As Object, e As MouseButtonEventArgs) Handles tileListBox.PreviewMouseRightButtonDown
e.Handled = True
End Sub