I have a datagrid with, let's say, 2 columns. Both columns are dropdown type cells. ColA is a ColumnStyle.Dropdownlist and a ValueList which is an UltraDropDown. ColB dropdown needs much more functionality, so it's set with it's EditorControl as an UltraTextEditor and the UltraTextEditor has a buttonsRight associated with a panel (and the panel contains all the good functionality I need).
My CellClickAction for the grid is CellSelect because I need to do dragdrop operations. I also have a DoubleClickCell handler which will put the cell into edit mode (performaction.entereditmode, if needed).
The problem is that although the two columns look alike (both cells have dropdown buttons), if I click on the dropdown button in ColA it will immediately dropdown and allow the user to choose a value. The ColA cell will only be "selected" if I click in the cell but not on the dropdown button. This is the behavior I want. However, if I click on the dropdown button in ColB it simply "selects" the cell as if I clicked in the cell itself and not in the dropdown button. You have to "doubleclick" the ColB cell to put it into edit mode and THEN click the dropdown button to get it to work.
I would like to be able to get ColB to immediately dropdown when the dropdown button is clicked, while "selecting" the cell only if the actual cell (and not the dropdown button) is clicked.
I would appreciate any guidance in how this might be done.
Thanks, Ron
Hi Mike,
Thanks a bunch. That was the solution I needed. For those interested in a VB style solution here is the code:
Dim MyGrid As UltraGrid = CType(sender, UltraGrid) If TypeOf MyGrid.DisplayLayout.UIElement.LastElementEntered Is Infragistics.Win.UltraWinEditors.EditorButtonUIElement Then Dim MyEditorButtonUIElement As Infragistics.Win.UltraWinEditors.EditorButtonUIElement = CType(MyGrid.DisplayLayout.UIElement.LastElementEntered, Infragistics.Win.UltraWinEditors.EditorButtonUIElement) If Not MyEditorButtonUIElement Is Nothing Then Dim MyDropDownEditorButton As Infragistics.Win.UltraWinEditors.DropDownEditorButton = CType(MyEditorButtonUIElement.GetContext(GetType(Infragistics.Win.UltraWinEditors.DropDownEditorButton)), Infragistics.Win.UltraWinEditors.DropDownEditorButton) If Not MyDropDownEditorButton Is Nothing Then If Not MyDropDownEditorButton.IsDroppedDown Then MyGrid.PerformAction(UltraGridAction.EnterEditMode) MyDropDownEditorButton.DropDown() End If End If End If End If
Hi Ron,
You should still report this to Infragistics. But here's a workaround in the mean time:
private void ultraGrid1_MouseDown(object sender, MouseEventArgs e) { UltraGrid grid = (UltraGrid)sender; EditorButtonUIElement editorButtonUIElement = grid.DisplayLayout.UIElement.LastElementEntered as EditorButtonUIElement; if (editorButtonUIElement != null) { DropDownEditorButton dropDownEditorButton = editorButtonUIElement.GetContext(typeof(DropDownEditorButton)) as DropDownEditorButton; if (dropDownEditorButton != null) { if (dropDownEditorButton.IsDroppedDown) { grid.PerformAction(UltraGridAction.EnterEditMode); dropDownEditorButton.DropDown(); } } } }
The ButtonDisplayStyle doesn't seem to be the problem. Setting it to always just causes it to display in every cell regardless of whether the mouse is in the cell or not. It doesn't make the button "clickable".
Seems like if you set a column to use ColumnStyle.DropDownList and associate a valuelist with it then whether or not the cell is "selected" the button itself is always "hot" (ie you can click on it and get the dropdown). However if you set a column so it's EditorControl is an UltraTextEditor and the UTE has a button, then that button is NOT hot when the cell is "selected". It's only hot when the cell is in edit mode.
So regardless of whether this is a bug or not, I will need to develop a workaround. Having the users see "identical" looking cells (both have a dropdown button) BUT having to do different things to get the cell to drop down will cause me untold grief and support calls. This is what I think I need:
Capture the mousedown event for the grid, if it's in a cell that has the Ultratexteditor as Editorcontrol then determine where in the cell he clicked (did he click on the button or in the cell body). If he clicked on the button then "force" the dropdown to drop down.... or something like that.
Questions to do this are:
1. How exactly can I determine if the mouse was in the "button" in the mousedown event?
2. How can I simulate clicking that button to force it to "drop down".
Again, thanks for your help on this. It's really appreciated.
Ron
You might try setting the ButtonDisplayStyle on the column to Always (if you are not already) and see if that helps. If not, I recommend that you create a small sample project demonstrating the inconsistent behavior and Submit an incident to Infragistics Developer Support so they can check it out.