예제 #1
0
        //todo: make virtual when unsealed
        void OnElementChanged(ElementChangedEventArgs <MediaElement> e)
        {
            if (e.OldElement != null)
            {
            }

            if (e.NewElement != null)
            {
                this.EnsureId();

                UpdateKeepScreenOn();
                UpdateLayoutParameters();
                UpdateShowPlaybackControls();
                UpdateSource();
                UpdateBackgroundColor();

                ElevationHelper.SetElevation(this, e.NewElement);
            }

            ElementChanged?.Invoke(this, new VisualElementChangedEventArgs(e.OldElement, e.NewElement));
        }
예제 #2
0
        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 = Platform.GetRenderer(element);
                    if (r != null)
                    {
                        if (System.Maui.Maui.IsLollipopOrNewer)
                        {
                            var elevation        = ElevationHelper.GetElevation(r.View) ?? 0;
                            var elementElevation = ElevationHelper.GetElevation(element, r.View.Context);

                            if (elementElevation == null)
                            {
                                if (elevation > elevationToSet)
                                {
                                    elevationToSet = elevation;
                                }

                                r.View.Elevation = elevationToSet;
                            }
                        }

                        if (!onlyUpdateElevations)
                        {
                            (_renderer.View as ViewGroup)?.BringChildToFront(r.View);
                        }
                    }
                }
            }
        }