Пример #1
0
        private void OpenPopup(Popup popupPanel, PlaneProjection panelCarrot, Button panelButton, int horizontalOffset, int verticalOffset)
        {
            //First we need to find out how big our window is, so we can center to it.
            CoreWindow currentWindow = Window.Current.CoreWindow;

            //Set our background rectangle to fill the entire window
            rectBackgroundHide.Height = currentWindow.Bounds.Height;
            rectBackgroundHide.Width = currentWindow.Bounds.Width;
            rectBackgroundHide.Margin = new Thickness(0, 0, 0, 0);

            //Make sure the background is visible
            rectBackgroundHide.Visibility = Windows.UI.Xaml.Visibility.Visible;

            //Now we figure out where the center of the screen is, and we 
            //move the popup to that location.
            var buttonBounds = panelButton.GetElementBounds(this);

            popupPanel.HorizontalOffset = buttonBounds.Left + horizontalOffset;
            popupPanel.VerticalOffset = buttonBounds.Top + verticalOffset;

            panelCarrot.RotationZ = 0;
            popupPanel.IsOpen = true;
        }