views:

500

answers:

1

I have a ListBox with SelectionMode="Multiple", which allows me to select multiple rows by clicking either the left or right mouse buttons. How can I restrict the selection to occur from the LEFT mouse button click only?

+1  A: 

I guess you have to write your own ListBox(Item), override the

    protected override void OnPreviewMouseRightButtonDown(MouseButtonEventArgs e)
    {
        base.OnPreviewMouseRightButtonDown(e);
    }

or

    protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
    {
        base.OnMouseRightButtonDown(e);
    }

EventHandler and use your custom ListBox(Item) in your xaml. Don't forget to call e.Handled = true; you probably can also use one of the more general mouse event handlers and check if the right mouse button has been clicked and then call e.Handled.

Torsten