I’ve implemented custom DataGridViewColumn, DataGridViewCell, and DataGridViewEditingControl classes as demonstrated in an MSDN Sample.
The problem I have is that while the DateTimePicker in the MSDN example is able to pop it’s calendar picker out and have it appear over top of the rows below, and cells adjacent to, it; my control is trapped within the space defined by the size of the DGV cell. My control consists of a textbox and a list of auto-complete suggestions; so I need a way to get the list to appear without making the row several times as tall as normal.
Since I took the example from MSDN and only changed to to the extend of swapping out DateTimePicker for MyControl and other related changes I assume the magic is happening in the base DateTimePicker class; but don’t know what I need to change in my control to have it behave the same way.
The
DataGridViewEditingControlyou implement is sized, moved into the cell area, and made visible when the cell enters edit mode. What you need is in addition to the editing control, a “popup control” which you can create when the editing control becomes active and destroy when it becomes not active.Here’s a simple WinForms popup control example: http://www.codeproject.com/Articles/17502/Simple-Popup-Control
However, if all you want is a cell with auto-completion, you can get that for free using the stock
DataGridViewTextBoxColumn, orDataGridViewComboBoxColumn.http://bytes.com/topic/c-sharp/answers/442061-autocompletestringcollection-text-box-datagridview-2-0-a