diff options
author | Jimmy Garrido <jimmygarrido@outlook.com> | 2016-12-16 17:08:03 -0800 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-12-17 01:08:03 +0000 |
commit | 6c8abfdc14138bb803272497b0f97793106acb08 (patch) | |
tree | 551ebabc66e998516afa36ce8d10b0d87762212e | |
parent | 3216ce4ccd096f8b9f909bbeea572dcf2a8c4466 (diff) | |
download | xamarin-forms-6c8abfdc14138bb803272497b0f97793106acb08.tar.gz xamarin-forms-6c8abfdc14138bb803272497b0f97793106acb08.tar.bz2 xamarin-forms-6c8abfdc14138bb803272497b0f97793106acb08.zip |
[Windows] Fix modal pages being laid out below soft buttons (#395)
-rw-r--r-- | Xamarin.Forms.Platform.WinRT.Phone/WindowsPhonePlatform.cs | 12 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WinRT/Platform.cs | 30 |
2 files changed, 5 insertions, 37 deletions
diff --git a/Xamarin.Forms.Platform.WinRT.Phone/WindowsPhonePlatform.cs b/Xamarin.Forms.Platform.WinRT.Phone/WindowsPhonePlatform.cs index 7564e673..524463f6 100644 --- a/Xamarin.Forms.Platform.WinRT.Phone/WindowsPhonePlatform.cs +++ b/Xamarin.Forms.Platform.WinRT.Phone/WindowsPhonePlatform.cs @@ -14,18 +14,6 @@ namespace Xamarin.Forms.Platform.WinRT _status.Hiding += OnStatusBarHiding; } - internal override Rectangle WindowBounds - { - get - { - bool landscape = Device.Info.CurrentOrientation.IsLandscape (); - double offset = (landscape) ? _status.OccludedRect.Width : _status.OccludedRect.Height; - - Rectangle original = base.WindowBounds; - return new Rectangle (original.X, original.Y, original.Width - ((landscape) ? offset : 0), original.Height - ((landscape) ? 0 : offset)); - } - } - readonly StatusBar _status; void OnStatusBarHiding (StatusBar sender, object args) diff --git a/Xamarin.Forms.Platform.WinRT/Platform.cs b/Xamarin.Forms.Platform.WinRT/Platform.cs index 75dd772c..e9f6b95c 100644 --- a/Xamarin.Forms.Platform.WinRT/Platform.cs +++ b/Xamarin.Forms.Platform.WinRT/Platform.cs @@ -213,14 +213,14 @@ namespace Xamarin.Forms.Platform.WinRT return new SizeRequest(); } - internal virtual Rectangle WindowBounds + internal virtual Rectangle ContainerBounds { get { return _bounds; } } internal void UpdatePageSizes() { - Rectangle bounds = WindowBounds; + Rectangle bounds = ContainerBounds; if (bounds.IsEmpty) return; foreach (Page root in _navModel.Roots) @@ -435,27 +435,7 @@ namespace Xamarin.Forms.Platform.WinRT void UpdateBounds() { - _bounds = new Rectangle(0, 0, _page.ActualWidth, _page.ActualHeight); -#if WINDOWS_UWP - StatusBar statusBar = MobileStatusBar; - if (statusBar != null) - { - bool landscape = Device.Info.CurrentOrientation.IsLandscape(); - bool titleBar = CoreApplication.GetCurrentView().TitleBar.IsVisible; - double offset = landscape ? statusBar.OccludedRect.Width : statusBar.OccludedRect.Height; - - _bounds = new Rectangle(0, 0, _page.ActualWidth - (landscape ? offset : 0), _page.ActualHeight - (landscape ? 0 : offset)); - - // Even if the MainPage is a ContentPage not inside of a NavigationPage, the calculated bounds - // assume the TitleBar is there even if it isn't visible. When UpdatePageSizes is called, - // _container.ActualWidth is correct because it's aware that the TitleBar isn't there, but the - // bounds aren't, and things can subsequently run under the StatusBar. - if (!titleBar) - { - _bounds.Width -= (_bounds.Width - _container.ActualWidth); - } - } -#endif + _bounds = new Rectangle(0, 0, _container.ActualWidth, _container.ActualHeight); } void OnRendererSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs) @@ -481,7 +461,7 @@ namespace Xamarin.Forms.Platform.WinRT previousPage.Cleanup(); } - newPage.Layout(new Rectangle(0, 0, _page.ActualWidth, _page.ActualHeight)); + newPage.Layout(ContainerBounds); IVisualElementRenderer pageRenderer = newPage.GetOrCreateRenderer(); _container.Children.Add(pageRenderer.ContainerElement); @@ -726,7 +706,7 @@ namespace Xamarin.Forms.Platform.WinRT if (Device.Idiom == TargetIdiom.Phone) { - double height = WindowBounds.Height; + double height = _page.ActualHeight; stack.Height = height; stack.Width = size.Width; border.BorderThickness = new Windows.UI.Xaml.Thickness(0); |