summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Garrido <jimmygarrido@outlook.com>2016-12-17 01:08:03 (GMT)
committerRui Marinho <me@ruimarinho.net>2016-12-17 01:08:03 (GMT)
commit6c8abfdc14138bb803272497b0f97793106acb08 (patch)
tree551ebabc66e998516afa36ce8d10b0d87762212e
parent3216ce4ccd096f8b9f909bbeea572dcf2a8c4466 (diff)
downloadxamarin-forms-6c8abfdc14138bb803272497b0f97793106acb08.zip
xamarin-forms-6c8abfdc14138bb803272497b0f97793106acb08.tar.gz
xamarin-forms-6c8abfdc14138bb803272497b0f97793106acb08.tar.bz2
[Windows] Fix modal pages being laid out below soft buttons (#395)
-rw-r--r--Xamarin.Forms.Platform.WinRT.Phone/WindowsPhonePlatform.cs12
-rw-r--r--Xamarin.Forms.Platform.WinRT/Platform.cs30
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 7564e67..524463f 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 75dd772..e9f6b95 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);