partial void OnPopupPanelChangedPartial(PopupPanel previousPanel, PopupPanel newPanel) { if (previousPanel?.Superview != null) { // Remove the current child, if any. previousPanel.Children.Clear(); previousPanel.RemoveFromSuperview(); } if (newPanel != null) { if (Child != null) { // Make sure that the child does not find itself without a TemplatedParent if (newPanel.TemplatedParent == null) { newPanel.TemplatedParent = TemplatedParent; } newPanel.AddSubview(Child); } newPanel.Background = GetPanelBackground(); RegisterPopupPanel(); } }
/// <summary> /// Ensure that Popup panel is forward-most in the window. This ensures it isn't hidden behind the main content, which can happen when /// the Popup is created during initial launch. /// </summary> private void EnsureForward() { //macOS does not have BringSubviewToFront, //solution based on https://stackoverflow.com/questions/4236304/os-x-version-of-bringsubviewtofront if (PopupPanel.Layer.SuperLayer != null) { var superlayer = PopupPanel.Layer.SuperLayer; PopupPanel.Layer.RemoveFromSuperLayer(); superlayer.AddSublayer(PopupPanel.Layer); } else if (PopupPanel.Superview != null) { var superview = PopupPanel.Superview; PopupPanel.RemoveFromSuperview(); superview.AddSubview(PopupPanel); } }
partial void OnUnloadedPartial() { PopupPanel?.RemoveFromSuperview(); }
partial void OnUnloadedPartial() { PopupPanel?.RemoveFromSuperview(); UnregisterPopupPanelChild(); }