Hi Rob,
I was able to get a popup to display the image instead but it is not centering like it is supposed to. I have the following method to center all my popup controls and it has worked previously but has not worked on this popup:
private void CenterPopup(Popup popup, bool autoHeight)
{
popup.IsOpen = true;
FrameworkElement child = popup.Child as FrameworkElement;
child.Width = Window.Current.Bounds.Width - 200;
popup.HorizontalOffset = 100;
child.UpdateLayout();
if(autoHeight)
{
popup.VerticalOffset = (Window.Current.Bounds.Height - child.ActualHeight) /2;
}
else
{
child.Height = Window.Current.Bounds.Height - 100;
child.MaxWidth = child.Width;
popup.VerticalOffset = 50;
}
}
And when centering the item in the Tapped event for the image I just say: CenterPopup(imageWindow, true); and it is perfectly centered.
But for this popup it seems to center on the page horizontally but not vertically. So it just is centered and is at the bottom of the frame. Any advice on how to fix this problem?
No comments:
Post a Comment