Won't Fix
Last Updated: 18 Aug 2016 08:17 by ADMIN
Telerik Admin
Created on: 10 Oct 2013 13:40
Category: AutoCompleteBox
Type: Bug Report
AutoCompleteBox: LostFocus and LostKeyboardFocus are rised when item is selected with the mouse
If there is only one item left in the drop down or it is the first item, when it is clicked with the mouse the events are raised. 
1 comment
Posted on: 18 Aug 2016 08:14

Recently we have reviewed this item and would like to inform you that with the current implementation of RadAutoCompleteBox the observed behavior of raising the LostFocus and LostKeyboardFocus events could be considered as an expected one.

When RadListBoxItem gets selected from the DropDown portion of RadAutoCompleteBox (the DropDown part of the control consist of RadListBox) the ListBoxItem internally gets the focus and removes the focus from the TextBox part of RadAutoCompleteBox - that cause the the LostFocus and LostKeyboardFocus event to be raised. Similar behavior of the LostFocus event could be observed with the native WPF ComboBox control - there the event is raised when the items of the DropDown part are just hovered. 

However, we are glad to inform you that there is an easy solution how you could prevent the events from raising when item gets selected:
- for WPF: You need to set the Focusable property of the RadListBoxItems to False. By doing so the ListBoxItems will not be focused after a selection - the Focus will remain inside the TextBox part and the events won't be raised.
- for Silverlight: You need to set the IsTabStop property for the RadListBoxItems to False. When that property is set to False the items won't be able to receive the focus and thus they won't be focused after a selection - the Focus will remain inside the TextBox part and the events won't be raised. (that approach won't prevent the functionality of RadAutoCompleteBox of selecting the HighlightItem with Tab from working - everything will continue to work as expected).

You could check the described above approaches in action:
- for WPF: please, check the "AutoCompleteSelectedItem" project.
- for SL: please, check the "AutoCompleteSelectedItemSL" project.