How to select a item on rightclick using devexpress ListboxControl

To select a item on rightclick using devexpress ListboxControl you need to use the MouseDown Event.
See the samples below.

Sample C#

[code language=”csharp”]
private void listBoxControl1_MouseDown(object sender, MouseEventArgs e)
{
listBoxControl1.SelectedIndex = listBoxControl1.IndexFromPoint(new Point(e.X, e.Y));
}
[/code]

Sample VB.NET

[code language=”vb”]
Private Sub listBoxControl1_MouseDown(sender As Object, e As MouseEventArgs)
listBoxControl1.SelectedIndex = listBoxControl1.IndexFromPoint(New Point(e.X, e.Y))
End Sub
[/code]