protected virtual void OnElementChanged(ElementChangedEventArgs <RadioButton> e) { if (e.NewElement != null && !_isDisposed) { this.EnsureId(); _textColorSwitcher = new Lazy <TextColorSwitcher>( () => new TextColorSwitcher(TextColors, e.NewElement.UseLegacyColorManagement())); UpdateFont(); UpdateTextColor(); UpdateInputTransparent(); UpdateBackgroundColor(); UpdateIsChecked(); UpdateContent(); ElevationHelper.SetElevation(this, e.NewElement); } ElementChanged?.Invoke(this, new VisualElementChangedEventArgs(e.OldElement, e.NewElement)); }
void EnsureChildOrder(bool onlyUpdateElevations) { float elevationToSet = 0; for (var i = 0; i < ElementController.LogicalChildren.Count; i++) { Element child = ElementController.LogicalChildren[i]; var element = (VisualElement)child; if (element != null) { IVisualElementRenderer r = AppCompat.Platform.GetRenderer(element); if (r != null) { if (Forms.IsLollipopOrNewer) { var elevation = ElevationHelper.GetElevation(r.View) ?? 0; var elementElevation = ElevationHelper.GetElevation(element, r.View.Context); if (elementElevation == null) { if (elevation > elevationToSet) { elevationToSet = elevation; } if (r.View.Elevation != elevationToSet) { r.View.Elevation = elevationToSet; } } } if (!onlyUpdateElevations) { (_renderer.View as ViewGroup)?.BringChildToFront(r.View); } } } } }