Repository: AvaloniaUI/Avalonia
File: src/Avalonia.Controls/ComboBox.cs (C#)

Code before:
                }
                else if (PseudoClasses.Contains(pcPressed))
                {
                    SetCurrentValue(IsDropDownOpenProperty, !IsDropDownOpen);
                    e.Handled = true;
                }
            }

            PseudoClasses.Set(pcPressed, false);
            base.OnPointerReleased(e);
        }

        /// <inheritdoc/>
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            if (_popup != null)
            {
                _popup.Opened -= PopupOpened;
                _popup.Closed -= PopupClosed;
            }

            _popup = e.NameScope.Get<Popup>("PART_Popup");
            _popup.Opened += PopupOpened;
            _popup.Closed += PopupClosed;

            _inputText = e.NameScope.Get<TextBox>("PART_InputText");
        }

        /// <inheritdoc/>
        protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
        {
            if (change.Property == SelectedItemProperty)
            {
                UpdateSelectionBoxItem(change.NewValue);
                TryFocusSelectedItem();
                UpdateInputTextFromSelection(change.NewValue);
            }
            else if (change.Property == IsDropDownOpenProperty)
            {
                PseudoClasses.Set(pcDropdownOpen, change.GetNewValue<bool>());
            }
            else if (change.Property == ItemTemplateProperty)
            {
                CoerceValue(SelectionBoxItemTemplateProperty);
            }
            else if (change.Property == IsEditableProperty && change.GetNewValue<bool>())
            {
                UpdateInputTextFromSelection(SelectedItem);
            }
            base.OnPropertyChanged(change);
        }

Review comment (suggestion):
Use `.Find()` instead of `Get()`, that template part should stay optional. As far as I can tell, there are already proper null checks everywhere.

Code after:
            }

            PseudoClasses.Set(pcPressed, false);
            base.OnPointerReleased(e);
        }

        /// <inheritdoc/>
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            if (_popup != null)
            {
                _popup.Opened -= PopupOpened;
                _popup.Closed -= PopupClosed;
            }

            _popup = e.NameScope.Get<Popup>("PART_Popup");
            _popup.Opened += PopupOpened;
            _popup.Closed += PopupClosed;

            _inputTextBox = e.NameScope.Find<TextBox>("PART_EditableTextBox");
        }

        /// <inheritdoc/>
        protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
        {
            if (change.Property == SelectedItemProperty)
            {
                UpdateSelectionBoxItem(change.NewValue);
                TryFocusSelectedItem();
                UpdateInputTextFromSelection(change.NewValue);
            }
            else if (change.Property == IsDropDownOpenProperty)
            {
                PseudoClasses.Set(pcDropdownOpen, change.GetNewValue<bool>());
            }
            else if (change.Property == ItemTemplateProperty)
            {
                CoerceValue(SelectionBoxItemTemplateProperty);
            }
            else if (change.Property == IsEditableProperty && change.GetNewValue<bool>())
            {
                UpdateInputTextFromSelection(SelectedItem);
            }
            else if (change.Property == TextProperty)
            {
                TextChanged(change.GetNewValue<string>());
            }
            else if (change.Property == ItemsSourceProperty)
            {
                //the base handler deselects the current item (and resets Text) so we want to run the base first, then try match by text
                string? text = Text;