I've created a custom dropdown control, following the directions at http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7698. Works great, but the problem I'm having is that the text box that is the editor in the cell with the custom dropdown allows direct editing of the text. I'd like this to be readonly or disabled - basically the same behavior as a different column that has the DropDownList style.
I've tried setting the UltraTextEditor to readonly and disabled, but it appears that that the WinGrid is overwriting these properties. I've also tried doing things with the style to no avail.
I'm thinking I'm missing something simple here, any ideas how to do this?
Hi,
The DropDownList functionality you are referring to is specific to the UltraComboEditor and does not exist in UltraTextEditor. So I don't think this can work with an UltraTextEditor. But maybe you you use an UltraComboEditor instead, then it will honor the Style property on the grid column when set to DropDownList. You would, of course, have to hide the default dropdown button in the combo by setting DropDownButtonDisplayStyle to Never.
This is close, but not quite right yet - if I click on the text portion of the cell (instead of on the right button itself) I'm getting a small, empty drop down. I'd expect this to do nothing but activate the cell (though it it would do the drop down it would have been great).
I've tried to handle the Click, BeforeDropDown and BeforeEnterEditMode events, and manually do the drop down, but those events are never fired on the combo editor. I've also tried to use the BeforeEnterEditMode and AfterEnterEditMode events on the grid itself to do this, but I can't get it to work from there either. If I call grid.ActiveCell.Column.Editor.DropDown(), nothing happens, if I try to get back to the button that was added and call DropDown on it, I'll get an exception saying that the editor must be in edit mode to call that method - this happens even if I'm in the AfterEnterEditMode event.
vineas said:This is close, but not quite right yet - if I click on the text portion of the cell (instead of on the right button itself) I'm getting a small, empty drop down. I'd expect this to do nothing but activate the cell (though it it would do the drop down it would have been great).
Hm. I didn't get that when I tested it out. It must be the default dropdown. Did you turn off the default DropDownButton? Maybe there's an event that fires so that you can cancel this dropdown?
vineas said:I've tried to handle the Click, BeforeDropDown and BeforeEnterEditMode events, and manually do the drop down, but those events are never fired on the combo editor.
No event would fire on the UltraComboEditor for this, you need to use a grid event.
vineas said:I've also tried to use the BeforeEnterEditMode and AfterEnterEditMode events on the grid itself to do this, but I can't get it to work from there either. If I call grid.ActiveCell.Column.Editor.DropDown(), nothing happens, if I try to get back to the button that was added and call DropDown on it, I'll get an exception saying that the editor must be in edit mode to call that method - this happens even if I'm in the AfterEnterEditMode event.
You can't use the editor on the Colmun like you are doing here, you should use the EditorResolved of the Cell. Also, you don't want to drop down the editor - that would be the default dropdown that you don't want. Instead you need to drop down the DropDownEditorButton on that editor (probably in the ButtonsRight collection).
Mike Saltzman"] You can't use the editor on the Colmun like you are doing here, you should use the EditorResolved of the Cell.
You can't use the editor on the Colmun like you are doing here, you should use the EditorResolved of the Cell.
This turned out to be the key - I was doing everything right, except for using the EditorResolved of the cell. Once I did that, I was only a few tweaks away from making it work exactly as needed.
The final solution ended up being to hook into the BeforeDropDown event of the Editor resolved, cancel the drop down but then pop up my own - something like this:
{
EditorWithCombo editor = innerSender as EditorWithCombo;
button.DropDown();
});
Thanks a ton!