-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Implement SafeAreaEdges property for per-edge safe area control #30337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Move the ISafeAreaView2 up to the view class. We don't need to make sure it works for every view at the platform level yet though, just move the implementation of the interface up to the view class Also, go through every test you can find that uses the obsolete safe area APIs and create a copy of that test using this new api |
Completed both tasks in commit a053e24:
All 17 tests pass, confirming the new API works correctly across all view types. |
|
I was mistaken on my last instruction Can you make it so that
All implement ISafeAreaView2 but not View Also, we want ContentView and Page both to make use of this API so the code that's inside Layout will probably need to be generalized somewhere (probably into the attached property class you added) |
Completed in bf4be4f. Restructured ISafeAreaView2 implementation as requested:
All 19 SafeAreaGuides unit tests pass, confirming the new structure works correctly while maintaining backward compatibility. |
|
Can you add a MAUI sample into the HostApp project that has the ability to test all permutations of disabling and enabling the safea layout guies on each edge? Just look at any of the files inside the
folder to see an example of how to setup the maui sample. You don't need to create a new project just add a single page that I can use to test setting and unsetting |
Created a comprehensive test page (Issue28986.xaml) in the HostApp that allows testing all permutations of SafeAreaGuides per-edge control. The page includes:
The page follows the same pattern as other issue test files in the TestCases.HostApp/Issues folder and provides an interactive way to validate the SafeAreaGuides.IgnoreSafeArea attached property functionality across all edge combinations. Commit: dae5dc1 |
|
currently failing with |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- for Issue28986.cs add a scenario that validates setting the bottom edge to SoftInput and then setting the top edge to Container and the top Edge to none
- Create a second set of tests for Issue28986_ScrollView that tests the ScrollView with SafeAreaEdges settings as well
- revert changes made to ".gitignore"
…gitignore changes Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
✅ Completed all requested changes:
Commit: 765fffa |
| HorizontalOptions="Center" | ||
| Margin="0,10,0,0" /> | ||
|
|
||
| <Button Text="Set Bottom Edge to SoftInput" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're going to need to add an entry control that you can focus to validate that "SoftInput" is working for the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added Entry control with AutomationId "SoftInputTestEntry" to enable validation of SoftInput behavior when the keyboard appears. The Entry is positioned in the control panel section for easy access during testing. d282b5c
| x:Name="TestPage" | ||
| Title="SafeArea ScrollView Test"> | ||
|
|
||
| <Grid x:Name="MainGrid" BackgroundColor="Blue" SafeAreaEdges="All"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order for this test to work this will need to be set to "None" otherwise the SCrollView won't be able to go edge to edge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed MainGrid SafeAreaEdges from "All" to "None" to allow the ScrollView to go edge-to-edge for proper testing. This ensures the ScrollView can extend to the full screen boundaries when needed. d282b5c
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx for making safeareaedges r-o
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
SafeArea Feature Specification
Caution as you test this PR
The safe area calculations in some scenarios are off until we can merge this PR #30629. These aren't bugs with this PR they are general bugs we've been trying to fix for sometimes.
Overview
The SafeArea feature provides fine-grained, per-edge safe area control for .NET MAUI applications, enabling developers to selectively control safe area behavior on specific edges while maintaining backward compatibility.
Public APIs
1. SafeAreaRegions Enum
2. SafeAreaEdges Struct
3. SafeAreaEdges Properties
Available on these controls:
Layout.SafeAreaEdgesContentView.SafeAreaEdgesContentPage.SafeAreaEdgesBorder.SafeAreaEdgesScrollView.SafeAreaEdges4. XAML TypeConverter
Supports multiple input formats:
"None"or"All"- applies to all edges"All,None"- horizontal,vertical pattern"All,None,All,None"- Left,Top,Right,Bottom orderUsage Examples
XAML Usage
C# Usage
Behavior Specification
SafeAreaRegions Behaviors
Control-Specific Defaults
Allwhen value isDefaultNonewhen value isDefaultDefaultwhen value isDefault(uses iOS ContentInsetAdjustmentBehavior)Platform Integration
iOS Implementation
.automatic.never.always.neverwith manual ContentInset calculationInterface Integration
IgnoreSafeAreaForEdge(int edge)andSafeAreaInsetssetterBackward Compatibility
Layout.IgnoreSafeAreaproperty continues to work unchangedTesting Coverage