private void OpenPopup(Popup popupPanel, TextBlock panelText, 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 textblockBounds = panelText.GetElementBounds(this); popupPanel.HorizontalOffset = horizontalOffset; popupPanel.VerticalOffset = verticalOffset; popupPanel.IsOpen = true; }