2010年8月16日 星期一

DataGridViewComboBoxColumn requires multiple clicks to select an item

原出處

If you have ever used a DataGridView with a DataGridViewComboBox column, then you would have definitely noticed that you need multiple clicks to select an item in the combo box. This is very annoying because every time you want to select a different item from the combo box, you need at least 2-3 clicks.

Fix

Fortunately, there is a simple fix for this: set the EditMode property of the data grid view to EditOnEnter. So, when the user enters the control, the cell is automatically put in edit mode, so when you actually click on the combo box, you can see the drop down list.
A bug

That being said, there is a bug associated with this. With the EditMode property set to EditOnEnter, when you select a row by clicking on the row header, the entire row is selected, but one cell will be in edit mode. What this means is if you try to delete the row by selecting the row header, you cannot delete the row because the delete key is actually being sent to the cell being edited and not the row.

==============
以上就是說:EditOnEnter 是重點!!

沒有留言:

張貼留言