Microsoft.Windows.Controls.Ribbon.RibbonComboBox.HighlightedItemUpdated C# (CSharp) Method

HighlightedItemUpdated() private method

private HighlightedItemUpdated ( ) : void
return void
        private void HighlightedItemUpdated()
        {
            try
            {
                UpdatingHighlightedItem = true;

                // If the highlight changed as a result of Text or the TextBox
                // changing, don't update the Text property - TextUpdated() will
                if (!UpdatingText)
                {
                    string text = String.Empty;
                    if (_firstGallery != null && _firstGallery.HighlightedCategory != null)
                    {
                        text = TextSearchInternal.GetPrimaryTextFromItem(_firstGallery.HighlightedCategory, HighlightedItem, true);
                        _firstGallery.ScrollIntoView(HighlightedItem);
                    }

                    // if _firstGallery.HighlightedCategory is null, it means HighlightedItem is null and we should set Text to empty string.
                    if (Text != text)
                    {
                        SetValue(TextProperty, text);
                    }
                }

                // Update SelectionItem/TextBox
                Update();
            }
            finally
            {
                UpdatingHighlightedItem = false;
            }
        }