Unplanned
Last Updated: 25 Feb 2021 14:54 by Keith
Martin Ivanov
Created on: 24 Sep 2020 13:27
Category: ComboBox
Type: Bug Report
6
ComboBox: Text get cleared when an item was previously selected and the control loses focus with an invalid text

According to the following article, when the UpdateSelectionOnLostFocus property is set to True and you enter a text that cannot update the selection, once the control loses the focus, the typed text should stay in the textbox. 
https://docs.telerik.com/devtools/wpf/controls/radcombobox/howto/perform-selection-only-lost-focus

However, this doesn't happen if an item is already selected. In this case, the searched text is cleared. If you do not have a selection, then the text stays on lost focus. 

To work this around, you can cache the value of the RadComboBox's Text property in the PreviewLostKeyboardFocus event handler and then restore it in the LostFocus event handler. 

private string textCache;
private void RadComboBox_PreviewLostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
{
	this.textCache = this.comboBox.Text;
}
private void RadComboBox_LostFocus(object sender, RoutedEventArgs e)
{
	this.comboBox.Text = this.textCache;
}

3 comments
Keith
Posted on: 25 Feb 2021 14:54
When you do look at it, also note that the problem also exists when hitting the Enter key. Thank you! 🙂
ADMIN
Kalin
Posted on: 25 Feb 2021 14:10

Hello Keith,

Thanks for your feedback. We are in process of review the issue here - will get back you with more details when possible.

Thanks for understanding.

Regards,
Kalin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Keith
Posted on: 18 Feb 2021 15:29
We really need this to be fixed. We have a very large commercial product that is sold globally that requires this functionality to work properly. Please fix this. It should be a relatively minor fix. Thank you!