/// <summary> /// Restore SelectedItem (or former SelectedItem) view to its position in the dropdown list. /// </summary> private void RestoreSelectedItem(_View selectionView) { var dropdownParent = _selectionParentInDropdown?.Target as FrameworkElement; #if __ANDROID__ var comboBoxItem = dropdownParent?.FindFirstParentOfView <ComboBoxItem>(); #else var comboBoxItem = dropdownParent?.FindFirstParent <ComboBoxItem>(); #endif // Sanity check, ensure parent is still valid (ComboBoxItem may have been recycled) if (comboBoxItem?.Content == selectionView && selectionView.GetVisualTreeParent() != dropdownParent) { dropdownParent.AddChild(selectionView); } }