This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Windows] Fix modal pages being laid out below soft buttons
- Loading branch information
1 parent
bd195ff
commit 617b337
Showing
2 changed files
with
5 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,14 +198,14 @@ SizeRequest IPlatform.GetNativeSize(VisualElement element, double widthConstrain | |
return new SizeRequest(); | ||
} | ||
|
||
internal virtual Rectangle WindowBounds | ||
internal virtual Rectangle ContainerBounds | ||
This comment has been minimized.
Sorry, something went wrong.
jimmgarrido
Author
Contributor
|
||
{ | ||
get { return _bounds; } | ||
} | ||
|
||
internal void UpdatePageSizes() | ||
{ | ||
Rectangle bounds = WindowBounds; | ||
Rectangle bounds = ContainerBounds; | ||
if (bounds.IsEmpty) | ||
return; | ||
foreach (Page root in _navModel.Roots) | ||
|
@@ -420,28 +420,7 @@ void CancelActionSheet() | |
|
||
void UpdateBounds() | ||
{ | ||
_bounds = new Rectangle(0, 0, _page.ActualWidth, _page.ActualHeight); | ||
#if WINDOWS_UWP | ||
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) | ||
{ | ||
StatusBar statusBar = StatusBar.GetForCurrentView(); | ||
|
||
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) | ||
|
@@ -467,7 +446,7 @@ async void SetCurrent(Page newPage, bool animated, bool popping = false, Action | |
previousPage.Cleanup(); | ||
} | ||
|
||
newPage.Layout(new Rectangle(0, 0, _page.ActualWidth, _page.ActualHeight)); | ||
newPage.Layout(ContainerBounds); | ||
|
||
IVisualElementRenderer pageRenderer = newPage.GetOrCreateRenderer(); | ||
_container.Children.Add(pageRenderer.ContainerElement); | ||
|
@@ -712,7 +691,7 @@ void OnPageActionSheet(Page sender, ActionSheetArguments options) | |
|
||
if (Device.Idiom == TargetIdiom.Phone) | ||
{ | ||
double height = WindowBounds.Height; | ||
double height = _page.ActualHeight; | ||
This comment has been minimized.
Sorry, something went wrong.
jimmgarrido
Author
Contributor
|
||
stack.Height = height; | ||
stack.Width = size.Width; | ||
border.BorderThickness = new Windows.UI.Xaml.Thickness(0); | ||
|
We no longer need to manually calculate the area the status bar is occluding since the bounds for Page.Content already factors that in.