none
how to disable white space clicking in multiselect liste box RRS feed

  • Question

  • HI All,

    Im working on an app that uses a multi-select listbox and I have noticed that clicking the white space will deselect the currently selected item & clicking it again will reselect it.

    this is causing problems with some of my code and i need to disable this behavior.

    (this behavior is not present with a single select listbox but i have a lot of stuff built around a multiselect box so i cant change)

    is this possible?

    Thank you,

    Chris

     

    Monday, October 20, 2014 8:22 PM

Answers

  • >>Im working on an app that uses a multi-select listbox and I have noticed that clicking the white space will deselect the currently selected item & clicking it again will reselect it.

    Yes, this is the expected behaviour when the SelectionMode property of the ListBox is set to MultiSimple. How else would you deselect an item?

    The other option is to set the SelectionMode property to MultiExtended but then you have to press the CTRL key on the keyboard and click with the mouse to be able to select/deselect multiple items:

     listBox1.SelectionMode = SelectionMode.MultiExtended;

    This is the way you generally select multiple items in a Windows application and it should be familiar to your users.

    Note that it is generally considered as a bad practice to force your users into some non-Windows behaviour when developing a Windows desktop application.

    Please remember to mark helpful posts as answer and/or helpful.

    • Marked as answer by Vapor162 Friday, October 24, 2014 8:29 PM
    Monday, October 20, 2014 9:14 PM

All replies

  • >>Im working on an app that uses a multi-select listbox and I have noticed that clicking the white space will deselect the currently selected item & clicking it again will reselect it.

    Yes, this is the expected behaviour when the SelectionMode property of the ListBox is set to MultiSimple. How else would you deselect an item?

    The other option is to set the SelectionMode property to MultiExtended but then you have to press the CTRL key on the keyboard and click with the mouse to be able to select/deselect multiple items:

     listBox1.SelectionMode = SelectionMode.MultiExtended;

    This is the way you generally select multiple items in a Windows application and it should be familiar to your users.

    Note that it is generally considered as a bad practice to force your users into some non-Windows behaviour when developing a Windows desktop application.

    Please remember to mark helpful posts as answer and/or helpful.

    • Marked as answer by Vapor162 Friday, October 24, 2014 8:29 PM
    Monday, October 20, 2014 9:14 PM
  • Hi Magnus,

    Sorry for the delayed reply, I got side tracked on another hot project!

    While this is not the answer i was wanting, I appreciate your reply and will probably just change the LB over to extended.

    as for the bad practice issue, i think in this case it is forgivable because the app i'm writing is a companion app to a 3Dmodeling package and im tailoring my app's behavior to fall in line with 3D software. 

    but anyway, thanks again!

    Friday, October 24, 2014 8:29 PM