We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridComboBox column opens in 3 clicks

I have a very special scenario, where I want to click on the cell to set focus and on second click want to open the combobox.
As otherwise it will create unneccessary disturbance for the end user with such a massive data on grid.

I came across different post where it is adviced to do

1:  Set EditTrigger="OnTap" as Grid property

and also
2:  set comboBox.IsDropDownOpen=true; in OnInitializedEditElement(....)
but problem with this approach is that on every single click on cell it opens the combobox.

Can I receive a quick response on this? As per my experience, I never gets answer.

Plus will I receive a notification email that my post has been responded??


7 Replies

DB Dinesh Babu Yadav Syncfusion Team May 30, 2019 10:21 AM UTC

Hi Qasim, 
Thanks for using Syncfusion products. 
You can set the EditTrigger property as OnDoubleTap if you want to open the dropdown or enter the cell in the edit mode. When the double click is made on the cell, it will enter the edit mode. And you can open the dropdown of the combo box column while enter to the edit mode by overriding the OnEditElementLoaded method of the GridCellComboBoxRenderer and set the IsDropDownOpen property as true.  It will open the dropdown while entering to the edit mode on the ComboBox column. 
Code Snippet: 
this.sfdatagrid.EditTrigger = EditTrigger.OnDoubleTap; 
this.sfdatagrid.CellRenderers.Add("ComboBox", new GridCellComboBoxRendererExt()); 
public class GridCellComboBoxRendererExt : GridCellComboBoxRenderer 
    protected override void OnEditElementLoaded(object sender, System.Windows.RoutedEventArgs e) 
        base.OnEditElementLoaded(sender, e); 
        var combobox = sender as ComboBox; 
        combobox.IsDropDownOpen = true;             
When the combo box column dropdown is open, clicking on the other cells will close the dropdown first and the cell will leave the editing for the second click. If you want to end cell editing while clicking outside the combobox cell. You can use the CellTapped event to end cell editing. Refer to the following snippet code, 
Code Snippet: 
this.sfdatagrid.CellTapped += sfdatagrid_CellTapped; 
void sfdatagrid_CellTapped(object sender, GridCellTappedEventArgs e) 
    if (sfdatagrid.SelectionController.CurrentCellManager.CurrentRowColumnIndex != e.RowColumnIndex  
        && sfdatagrid.SelectionController.CurrentCellManager.CurrentCell.Renderer is GridCellComboBoxRendererExt) 
        var comboBox = (sfdatagrid.SelectionController.CurrentCellManager.CurrentCell.Renderer as GridCellComboBoxRendererExt).CurrentCellRendererElement as ComboBox; 
        if (comboBox != null) 
            //Activate the tapped cell to end the editing of the combo box cell. 
Please let us know if you require further assistance. 
Dinesh Babu Yadav 

CF Carlos Fernando Consigli May 31, 2019 10:38 PM UTC

Hi. Qasim, sorry for hijacking this thread, but I need exactly what you are saying and I think Dinesh's sample is not exactly what we are looking for.
I also need one click to focus the cell and, later, another click to open the combo, BUT these two clicks are not necessarily a double click. In the sample provided, you must actually "double click" the cell for it to work.

In my solution, I'm calling BeginEdit inside the CellTapped handler, but it works inconsistently. For example:
1) If you come from another row, it ALWAYS work.
2) If you come from a cell in the same row that is NOT a combo cell, it ALWAYS work.
3) If you come from a cell in the same row that is also a combo, it sometimes work and sometimes it doesn't. I can't find the pattern.

Please see the sample I'm attaching, based on yours.
Try case 3: 
Follow these steps:
1) Click a cell in ShipCity column (cell gets into edit mode:: if you would clicked again it would open the combo)
2) Click a cell in the ShipCountry column in the same row (same as previous)
3) Click a cell in the AnotherTestColumn column in the same row, now the cell does not begin edit mode and you have to click one more time to begin edit mode and another time to open the combo (hence, the three clicks mentioned by Qasim).
Just click the three combo cells in different orders (but always in the same row) in this sample and you will see the odd behavior. For example, it seems to always work when you go from the column "ShipCity" to "AnotherTestColumn" or viceversa but it always fail when you go from ShipCountry to ShipCity or from ShipCountry to AnotherTestColumn.

Another thing that happens in my project but that I could not reproduce it in this sample is that it sometimes also fails to begin edit mode when the previous cell was also a combo cell and you have edited it. Sometimes the target cell starts edit mode and sometimes it doesn't. I couldn't find the pattern in those cases either.
The fact that I could not reproduce this last issue in this sample makes me think that maybe there is some timing issue (my project has another stuff going on so maybe it's a little "slower" than this super light sample).

Do you have something to recommend us?
Again, I'm sorry Qasim for stepping in your thread but I understand we are looking for the same behavior.

Attachment: ComboSample_b89ba0ec.zip

QR Qasim Raza June 3, 2019 07:13 AM UTC

Hi Dinesh,

I do not think you understood my problem. Let me explain this again.

Step 1: click on a cell in a column (which is a combobox column) to set focus. Combobox arrow button appears.
Step 2: click on the cell again to open the combobox.
          this is what I am looking for. 

Please notice on first click I tried to set the focus on the cell.
On second click, I am interested to open the combobox.

I do not want to open the combobox of the cell on double click. Its very confusing behavior

Please confirm  you undrstand the problem.

SP Shobika Palani Syncfusion Team June 3, 2019 12:53 PM UTC

Hi Carlos, 

We can reproduce the reported issue from our end. This is due to the sample level code handled in the CurrentCellEndEdit event that was handled to achieve ComboBox's ItemsSourceSelector behavior. If you do not use ItemsSourceSelector for GridComboBoxColumn in your application, you can remove the below highlighted code in the event CurrentCellEndEdit. 

private void DataGrid_CurrentCellEndEdit(object sender, CurrentCellEndEditEventArgs e) 
     var sfDataGrid = sender as SfDataGrid; 
     if (sfDataGrid.CurrentColumn.MappingName != "ShipCountry") 
     var datarow = dataGrid.RowGenerator.Items.FirstOrDefault(dr => dr.RowIndex == e.RowColumnIndex.RowIndex); 
     datarow.Element.DataContext = null; 

Could you please confirm whether you are using ItemsSourceSelector behavior in your application? So we will investigate further and provide earlier prompt solution. 


SP Shobika Palani Syncfusion Team June 3, 2019 12:55 PM UTC

Hi Qasim, 

We regret for the inconvenience caused. 

We understood that your requirement was to open the drop-down of combobox in a second click. You can achieve this requirement by setting SfDataGrid. EditTrigger as OnTap alone and you do not want to write any custom renderer for the ComboBox column. 

Please let us know if your requirement differs from the above solution. 


QR Qasim Raza June 4, 2019 06:37 AM UTC

Let me explain the requirement again. Purpose is not to get unnecessary clicks just to open a combobox appearing in column.

Required Solution.

User clicks on a cell (this cell is in comboBoxcolumn) within the sfDataGrid to set the focus on the desired cell.
Then user will click only one more time (single click not double click) to open the combobox. As soon as user click any where else on the grid or any where else
combobox is supposed to be close.

I have also sent email to Douglas with a simple sample solution to share the problem, I am facing.

Looking forward to hear from you.

AK Adhikesevan Kothandaraman Syncfusion Team June 5, 2019 12:43 PM UTC

Hi Qasim, 

Thanks for your update. 

As we said earlier, by default while setting the EditTrigger as onTap, the combobox will be loaded on the first click on the combobox cell and it will be show the dropdown on the second click. 
Please refer to the attached video link, 

Video Link: 


Live Chat Icon For mobile
Up arrow icon