Last Updated: 08 Apr 2022 10:44 by Martin Ivanov
Martin Ivanov
Created on: 08 Apr 2022 10:44
Category: DataGrid
Type: Bug Report
DataGrid: Drop down of the ComboBox column's cell cannot be opened unless you click on the selected text

If you use the DataGridComboBoxColumn or the DataGridTemplateColumn with a ComboBox in its template, you cannot open the drop down of the ComboBox when you click onto it. This reproduces only if you try to click on the arrow icon that opens the drop down or somewhere in the control where no text is presented. If you have already selected item and some text is displayed, you can click onto the text in order to open the drop down.

This reproduces also if the ComboBox is defined in the RowDetailsTemplate of the DataGrid.

To workaround this, you can subscribe to the Tapped event of  ComboBox control and set the Handled property of the event arguments to True. If you use the DataGridComboBoxColumn, you can create a custom class that derives from it and override its CreateEditorContentVisual method. This will allow you to get the ComboBox and subscribe to its event.


public class CustomComboBoxColumn : DataGridComboBoxColumn
	public override FrameworkElement CreateEditorContentVisual()
		var comboBox = (ComboBox)base.CreateEditorContentVisual();
		comboBox.Unloaded += ComboBox_Unloaded;
		comboBox.Tapped += ComboBox_Tapped;
		return comboBox;

	private void ComboBox_Unloaded(object sender, RoutedEventArgs e)
		var comboBox = (ComboBox)sender;
		comboBox.Unloaded -= ComboBox_Unloaded;
		comboBox.Tapped -= ComboBox_Tapped;

	private void ComboBox_Tapped(object sender, Microsoft.UI.Xaml.Input.TappedRoutedEventArgs e)
		e.Handled = true;