You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[regression/7.0.0] ISafeAreaView.IgnoreSafeArea isn't respected in .NET 7Β #12823
I've upgraded my project from .NET6 to .NET7 and noticed that IgnoreSafeArea I use within page content layout (i.e. Grid) is not respected anymore. SafeArea is still there whether IgnoreSafeArea is true or false. It works well in .NET6.
Steps to Reproduce
Create .NET 7 MAUI project
Create ContentPage with Grid set as Content
Set Grid BackgroundColor to Grey and IgnoreSafeArea to True
Assign the newly created page to the MainPage property of App class
Using it on the page is how I tried with no effect - to be honest I don't really see the point of adding the option onto individual layouts, as it should be a page-level concern anyway, shouldn't it? Xamarin only had the option on the page and worked fine.
The only thing that might be nice is to allow the developer to opt in/out of individual safe area directions (i.e. flow the page into the top, but not the bottom safe zone), but let's not run before we can walk (or crawl!).
I managed to work around this in the end with the following, painful hack;
Firstly, you must set the UseSafeArea to be false on the page.
Basically, you pull the insets manually from the underlying OS (away from the broken MAUI abstraction), flip the sign and patch the values into the insets object provided by the broken MAUI bits, then use those values to set a negative page padding manually to "drag" it into the safe inset space.
Horrible hack I know, but any of you ex-Xamarin victims developers will be used to it.
IgnoreSafeArea also can't be set in a StyleSheet for all Grids/ Layouts as it doesn't seem to have the necessary getters and setters to do so. Is there some sort of workaround to set the default to ignoring the safe area for all pages and layouts?
AND ALSO DO NOT use the community toolkit status behavior, because it sets the color above the content, that now should be placed in the unsafe area!
From there it is then a lot easier to remove the content back to the SafeArea when it is actually desired... If you want to change the color for Android for different pages, then you can still use the toolkit but ensure the code runs only on Android and not on iOS.
When this would be the default behaviour, the Layout Property UseSafeArea becomes actually very useful, because now it is possible to tell any child and their children if it should only use the safe area or not. In any nested view with a few layouts, this didnt work before.
changed the title [-][regression/net7.0] ISafeAreaView.IgnoreSafeArea isn't respected in .NET 7[/-][+][regression/7.0.0] ISafeAreaView.IgnoreSafeArea isn't respected in .NET 7[/+]on Sep 19, 2023
Activity
bcaceiro commentedon Jan 24, 2023
I am facing the same problem.
scriptBoris commentedon Mar 21, 2023
Any updates?
anupkrjee commentedon Apr 7, 2023
I am facing same issue in .NET 7
nathanjeynes commentedon Apr 11, 2023
This is an issue for us as well, this is basic functionality which has been broken in .NET 7 and should be fixed
RobTF commentedon Apr 27, 2023
Yep, got this issue as well. Idea of ETA for fix would be much appreciated. Is basic required functionality.
ianbaddino commentedon May 3, 2023
I also have this blocking issue. Is this working in .NET 6 / 8?
I'm using a ContentPage with a nested WebView
I have tried both the XAML and the following code-behind solution to no avail.
On().SetUseSafeArea(false);
mattleibow commentedon May 3, 2023
I just tested with .NET MAUI 7.0.81 using the iOS platform specific ad it seems to work when you set it on the
Pagenot the layouts. The docs also indicate this: https://learn.microsoft.com/dotnet/maui/ios/platform-specifics/page-safe-area-layoutLooking at the code for the Layout, not sure that does anything as seems to only be half implemented as is not even a bindable property.
RobTF commentedon May 3, 2023
Using it on the page is how I tried with no effect - to be honest I don't really see the point of adding the option onto individual layouts, as it should be a page-level concern anyway, shouldn't it? Xamarin only had the option on the page and worked fine.
The only thing that might be nice is to allow the developer to opt in/out of individual safe area directions (i.e. flow the page into the top, but not the bottom safe zone), but let's not run before we can walk (or crawl!).
I managed to work around this in the end with the following, painful hack;
Firstly, you must set the UseSafeArea to be false on the page.
Then, create some service to obtain the safe area insets (for Android just return 0 everywhere).
Then in the page...
I found this here;
https://stackoverflow.com/questions/74724489/net-maui-ios-usesafearea-not-working-stacklayout-verticalstacklayout-and-grid
Basically, you pull the insets manually from the underlying OS (away from the broken MAUI abstraction), flip the sign and patch the values into the insets object provided by the broken MAUI bits, then use those values to set a negative page padding manually to "drag" it into the safe inset space.
Horrible hack I know, but any of you ex-Xamarin
victimsdevelopers will be used to it.14 remaining items
Revert default for UseSafeAreaProperty to value from .NET 6 for iOS (#β¦
borrmann commentedon Jul 25, 2023
IgnoreSafeArea also can't be set in a StyleSheet for all Grids/ Layouts as it doesn't seem to have the necessary getters and setters to do so. Is there some sort of workaround to set the default to ignoring the safe area for all pages and layouts?
borrmann commentedon Jul 25, 2023
So I scanned through a lot of related issues like here 12417 and to be able to generically use all the available space per default I am using the
Mapper from @Felicity-R
and I have to set UseSafeArea like @hartez commented
on all my (Base) ContentPages
Also add
somewhere in the AndroidActivity
AND ALSO DO NOT use the community toolkit status behavior, because it sets the color above the content, that now should be placed in the unsafe area!
From there it is then a lot easier to remove the content back to the SafeArea when it is actually desired... If you want to change the color for Android for different pages, then you can still use the toolkit but ensure the code runs only on Android and not on iOS.
When this would be the default behaviour, the Layout Property UseSafeArea becomes actually very useful, because now it is possible to tell any child and their children if it should only use the safe area or not. In any nested view with a few layouts, this didnt work before.
Revert default for UseSafeAreaProperty to value from .NET 6 for iOS (#β¦
Revert default for UseSafeAreaProperty to value from .NET 6 for iOS (#β¦
[-][regression/net7.0] ISafeAreaView.IgnoreSafeArea isn't respected in .NET 7[/-][+][regression/7.0.0] ISafeAreaView.IgnoreSafeArea isn't respected in .NET 7[/+]