Skip to content

Commit

Permalink
Fix UWP popup view layout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jessejiang0214 committed Sep 1, 2016
1 parent 4d1c5b0 commit 0d3df20
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion SlideOverKit.UWP/SlideOverKitUWPHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,16 @@ bool PopupLayout()
return false;
var popup = _popupBasePage.PopupViews[_currentPopup] as SlidePopupView;

popup.CalucatePosition();
Point? position = null;
if (popup.TargetControl!=null)
{
var nativeElement = popup.TargetControl.GetOrCreateRenderer() as Panel;
var ttv = nativeElement.TransformToVisual(Window.Current.Content);
var wpos = ttv.TransformPoint(new Windows.Foundation.Point(0, 0));
position = new Point(wpos.X, wpos.Y);
}

popup.CalucatePosition(position);
double y = popup.TopMargin;
double x = popup.LeftMargin;
double width = (popup.WidthRequest <= 0 ? ScreenSizeHelper.ScreenWidth - popup.LeftMargin * 2 : popup.WidthRequest);
Expand Down

0 comments on commit 0d3df20

Please sign in to comment.