System.Windows.Controls.AutoCompleteBox.OnSelectedItemChanged C# (CSharp) Méthode

OnSelectedItemChanged() private méthode

Called when the selected item is changed, updates the text value that is displayed in the text box part.
private OnSelectedItemChanged ( object newItem ) : void
newItem object The new item.
Résultat void
        private void OnSelectedItemChanged(object newItem)
        {
            var text = newItem == null ? SearchText : FormatValue(newItem, true);

            // Update the Text property and the TextBox values
            UpdateTextValue(text);

            // Move the caret to the end of the text box
            if(TextBox != null && Text != null)
            {
                TextBox.SelectionStart = Text.Length;
            }
        }