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
close icon

GridComboBoxColumn takes 2 clicks to open the dropdown

Hi,
GridComboBoxColumn  in SfDataGrid takes 2 clicks to open the dropdown. I have EditTrigger="OnTap" set for grid and AllowFocus = True  set for combobox column. How do I make the combobox column to open dropdown in single click?

3 Replies

EM Elavarasan M Syncfusion Team April 25, 2015 12:58 AM UTC

Hi Vasanth,
Thank you for using Syncfusion Products.
We have analysed your query and you can achieve your requirement by customizing default cell renderer of GridComboBoxColumn.
For customizing, you need to create customized combobox renderer by deriving it from GridCellComboBoxRenderer. In the customized combobox renderer, you need to override the OnEditElementLoaded method and enable IsDropDownOpen of property of combobox as true.
Please refer the below code snippet to create customize combobox cell renderer and override the OnEditElementLoaded method.
Code Snippet:

public class ComboBoxRenderer : GridCellComboBoxRenderer

{

protected override void OnEditElementLoaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)

{

(sender as ComboBox).IsDropDownOpen = true;

base.OnEditElementLoaded(sender, e);

}
}


After creating customized combobox cell renderer, you need to remove default combobox cell renderer and add the customized cell renderer as shown in below code snippet,
Code Snippet:

//Default combobox cell renderer is removed.

this.sfgrid.CellRenderers.Remove("ComboBox");


//customized combobox cell renderer is added.
this.sfgrid.CellRenderers.Add("ComboBox",new ComboBoxRenderer());


We have prepared a sample for your requirement also and please refer the sample from below location.
Sample location:
http://www.syncfusion.com/downloads/support/forum/118922/ComboboxOnTapped1557069275.zip
Please let us know if you have any queries.

Thanks,
Elavarasan M


VA Vasanth April 27, 2015 01:29 PM UTC

Worked like a champ, thanks!


JS Jayapradha S Syncfusion Team April 28, 2015 03:34 AM UTC

Hi Vasanth,

Thank you for your update.

Please let us know if you have any other queries.

Regards,
Jayapradha


Loader.
Live Chat Icon For mobile
Up arrow icon