System.Windows.Controls.AutoCompleteBox.OnAdapterSelectionComplete C# (CSharp) Method

OnAdapterSelectionComplete() private method

Handles the Commit event on the selection adapter.
private OnAdapterSelectionComplete ( object sender, RoutedEventArgs e ) : void
sender object The source object.
e RoutedEventArgs The event data.
return void
        private void OnAdapterSelectionComplete(object sender, RoutedEventArgs e)
        {
            IsDropDownOpen = false;

            // Completion will update the selected value
            UpdateTextCompletion(false);

            // Text should not be selected
            if(TextBox != null)
            {
                TextBox.Select(TextBox.Text.Length, 0);
            }

#if SILVERLIGHT
            Focus();
#else
            // Focus is treated differently in SL and WPF.
            // This forces the textbox to get keyboard focus, in the case where
            // another part of the control may have temporarily received focus.
            if(TextBox != null)
            {
                Keyboard.Focus(TextBox);
            }
            else
            {
                Focus();
            }
#endif
        }