Return Focus to RadMultiColumnComboBox After its Drop Down Closes
Environment
Product Version | 2019.3.917 |
Product | RadMultiColumnComboBox for WPF |
Description
How to return the focus to RadMultiColumnComboBox after the Popup with its drop down content closes.
Solution
To do this, you can subscribe to the DropDownClosed event of the control and in the event handler manually focus the text input control.
public MainWindow()
{
InitializeComponent();
this.radMultiColumnComboBox.AddHandler(RadDropDownButton.DropDownClosedEvent, new RoutedEventHandler(OnMCCBDropDownClosed));
}
private void OnMCCBDropDownClosed(object sender, RoutedEventArgs e)
{
var mccb = (RadMultiColumnComboBox)sender;
mccb.ChildrenOfType<RadWatermarkTextBox>().First().Focus();
}
private void RadGridView_PreparedCellForEdit(object sender, GridViewPreparingCellForEditEventArgs e)
{
var mccb = e.EditingElement as RadMultiColumnComboBox;
if (mccb ! null)
{
mccb.AddHandler(RadDropDownButton.DropDownClosedEvent, new RoutedEventHandler(OnMCCBDropDownClosed));
}
}
private void OnMCCBDropDownClosed(object sender, RoutedEventArgs e)
{
var mccb = (RadMultiColumnComboBox)sender;
mccb.ChildrenOfType<RadWatermarkTextBox>().First().Focus();
}