Beispiel #1
0
        partial void OnPopupPanelChanged(DependencyPropertyChangedEventArgs e)
        {
            var previousPanel = e.OldValue as PopupPanel;
            var newPanel      = e.NewValue as PopupPanel;

            if (previousPanel?.Superview != null)
            {
                // Remove the current child, if any.
                previousPanel.Children.Clear();

                previousPanel.RemoveFromSuperview();
            }

            if (PopupPanel != null)
            {
                if (Child != null)
                {
                    // Make sure that the child does not find itself without a TemplatedParent
                    if (PopupPanel.TemplatedParent == null)
                    {
                        PopupPanel.TemplatedParent = TemplatedParent;
                    }

                    PopupPanel.AddSubview(Child);
                }

                RegisterPopupPanel();
            }
        }
Beispiel #2
0
        private protected override void OnUnloaded()
        {
            base.OnUnloaded();

            PopupPanel?.RemoveFromSuperview();
            UnregisterPopupPanelChild();
        }
Beispiel #3
0
        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();
            }
        }
Beispiel #4
0
        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 = IsLightDismissEnabled
                                        ? new SolidColorBrush(Colors.Transparent)
                                        : null;

                RegisterPopupPanel();
            }
        }
Beispiel #5
0
        public Popup()
        {
            MainWindow = UIApplication.SharedApplication.KeyWindow ?? UIApplication.SharedApplication.Windows[0];

            PopupPanel = new PopupPanel(this);

            MainWindow.AddSubview(PopupPanel);

            UpdateDismissTriggers();
        }
Beispiel #6
0
        partial void InitializePartial()
        {
#if __ANDROID__
            if (_useNativePopup)
            {
                InitializeNativePartial();
            }
#endif

            PopupPanel = new PopupPanel(this);
        }
Beispiel #7
0
        partial void InitializePartial()
        {
#if __ANDROID__
            if (FeatureConfiguration.Popup.UseNativePopup)
            {
                InitializeNativePartial();
            }
#endif

            PopupPanel = new PopupPanel(this);
        }
Beispiel #8
0
        private void RegisterPopupPanel()
        {
            if (PopupPanel == null)
            {
                PopupPanel = new PopupPanel(this);
            }

            if (PopupPanel.Superview == null)
            {
                MainWindowContent?.AddSubview(PopupPanel);
            }
        }
Beispiel #9
0
        partial void OnPopupPanelChangedPartial(PopupPanel previousPanel, PopupPanel newPanel)
        {
            previousPanel?.Children.Clear();

            if (PopupPanel != null)
            {
                if (Child != null)
                {
                    PopupPanel.Children.Add(Child);
                }
            }
        }
Beispiel #10
0
        partial void OnPopupPanelChangedPartial(PopupPanel previousPanel, PopupPanel newPanel)
        {
            previousPanel?.Children.Clear();

            if (newPanel != null)
            {
                if (Child != null)
                {
                    newPanel.Children.Add(Child);
                }
                newPanel.Background = GetPanelBackground();
            }
        }
Beispiel #11
0
        private void RegisterPopupPanel()
        {
            if (PopupPanel == null)
            {
                PopupPanel = new PopupPanel(this);
                UpdateDismissTriggers();
            }

            if (PopupPanel.Superview == null)
            {
                MainWindow.AddSubview(PopupPanel);
            }
        }
Beispiel #12
0
        partial void OnPopupPanelChangedPartial(PopupPanel previousPanel, PopupPanel newPanel)
        {
            previousPanel?.Children.Clear();

            if (newPanel != null)
            {
                if (Child != null)
                {
                    newPanel.Children.Add(Child);
                }
                newPanel.Background = IsLightDismissEnabled
                                        ? new SolidColorBrush(Colors.Transparent)
                                        : null;
            }
        }
Beispiel #13
0
        protected override void OnIsOpenChanged(bool oldIsOpen, bool newIsOpen)
        {
            base.OnIsOpenChanged(oldIsOpen, newIsOpen);

            RegisterPopupPanel();

            UpdateLightDismissLayer(newIsOpen);

            // this is necessary as during initial measure the panel was Collapsed
            // and got 0 available size from its parent (root Window element, usually a Frame)
            // this will ensure the size of its child will be calculated properly
            PopupPanel.OnInvalidateMeasure();

            EnsureForward();
        }
Beispiel #14
0
        public Popup()
        {
            _popupWindow = new PopupWindow(this, WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent, true);

            _popupWindow.Width     = WindowManagerLayoutParams.MatchParent;
            _popupWindow.Height    = WindowManagerLayoutParams.MatchParent;
            _popupWindow.Focusable = true;
            _popupWindow.Touchable = true;

            OnIsLightDismissEnabledChanged(false, true);

            _popupWindow.DismissEvent += OnPopupDismissed;

            PopupPanel = new PopupPanel(this);
        }
Beispiel #15
0
        partial void OnPopupPanelChangedPartialNative(PopupPanel previousPanel, PopupPanel newPanel)
        {
            previousPanel?.Children.Clear();

            if (PopupPanel != null)
            {
                if (Child != null)
                {
                    PopupPanel.Children.Add(Child);
                }
            }

            _popupWindow.ContentView = newPanel;

            UpdatePopupPanelDismissibleBackground(IsLightDismissEnabled);
        }
Beispiel #16
0
 /// <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);
     }
 }
Beispiel #17
0
        protected override void OnChildChanged(UIElement oldChild, UIElement newChild)
        {
            base.OnChildChanged(oldChild, newChild);

            if (PopupPanel != null)
            {
                if (oldChild != null)
                {
                    PopupPanel.RemoveChild(oldChild);
                }

                if (newChild != null)
                {
                    PopupPanel.AddSubview(newChild);
                }
            }
        }
Beispiel #18
0
        partial void OnPopupPanelChangedPartial(PopupPanel previousPanel, PopupPanel newPanel)
        {
#if __ANDROID__
            if (_useNativePopup)
            {
                OnPopupPanelChangedPartialNative(previousPanel, newPanel);
            }
            else
#endif
            {
                previousPanel?.Children.Clear();

                if (newPanel != null)
                {
                    if (Child != null)
                    {
                        newPanel.Children.Add(Child);
                    }
                    newPanel.Background = GetPanelBackground();
                }
            }
        }
Beispiel #19
0
        partial void OnPopupPanelChanged(DependencyPropertyChangedEventArgs e)
        {
            var previousPanel = e.OldValue as PopupPanel;
            var newPanel      = e.NewValue as PopupPanel;

            if (previousPanel?.Superview != null)
            {
                // Remove the current child, if any.
                previousPanel.Children.Clear();

                previousPanel.RemoveFromSuperview();
            }

            if (PopupPanel != null)
            {
                if (Child != null)
                {
                    PopupPanel.AddSubview(Child);
                }

                RegisterPopupPanel();
            }
        }
Beispiel #20
0
 public Popup()
 {
     PopupPanel = new PopupPanel(this);
 }
Beispiel #21
0
 partial void OnPopupPanelChangedPartialNative(PopupPanel previousPanel, PopupPanel newPanel);
Beispiel #22
0
        protected override void OnUnloaded()
        {
            base.OnUnloaded();

            PopupPanel?.RemoveFromSuperview();
        }
Beispiel #23
0
		partial void OnPopupPanelChangedPartial(PopupPanel previousPanel, PopupPanel newPanel)
		{
		}
Beispiel #24
0
 partial void InitializePartial()
 {
     PopupPanel = new PopupPanel(this);
 }