Category / Section
How to open the DropDown with a single click in the GridComboBoxColumn in WinRT DataGrid?
1 min read
You can open the DropDown with a single click in the GridComboBoxColumn by deriving a new class from the GridCellComboBoxRenderer and overriding the OnEditElementLoaded virtual method as follows.
C#
public class ComboBoxRenderer : GridCellComboBoxRenderer { protected override void OnEditElementLoaded(object sender, System.Windows.RoutedEventArgs e) { base.OnEditElementLoaded(sender, e); var combobox = sender as ComboBox; combobox.IsDropDownOpen = true; } }
Refer to the following code example to remove the default GridCellComboBoxRenderer and add the customized GridCellComboBoxRendererExt to the SfDataGrid.CellRenderer collection and Set EditTrigger as OnTap in SfDataGrid.
C#
public MainWindow() { InitializeComponent(); //Default combobox cell renderer is removed. this.sfgrid.CellRenderers.Remove("ComboBox"); //Customized combobox cell renderer is added. this.sfgrid.CellRenderers.Add("ComboBox", new ComboBoxRenderer()); }
Xaml
<syncfusion:SfDataGrid Name="sfgrid" AllowEditing="True" AutoGenerateColumns="False" ColumnSizer="SizeToHeader" EditTrigger="OnTap" ItemsSource="{Binding StoreLists}">
Samples