Skip to content

[net11] Let custom views provide their own safe-area strategy — make the SafeAreaEdges API public (ISafeAreaView2), as ISafeAreaView was in net9 #37384

Closed

Description

@albyrock87

Summary

In .NET 10 the safe-area model became per-edge and much more expressive (SafeAreaEdges / SafeAreaRegions), but only MAUI's own types can participate in it. A custom view — including one whose platform view is a MauiView — cannot declare its own safe-area strategy beyond the legacy all-or-nothing opt-out.

What is public today, and what is not

API Visibility
SafeAreaRegions (enum), SafeAreaEdges (struct) public
ISafeAreaView (net9 model: bool IgnoreSafeArea) public
ISafeAreaView2 (GetSafeAreaRegionsForEdge(int), HasExplicitSafeAreaEdges) internal
ISafeAreaElement, SafeAreaElement (the SafeAreaEdgesProperty plumbing) internal
SafeAreaEdges property declared per type (Layout, Border, ScrollView, ContentPage), not on VisualElement / IView

MauiView (iOS) resolves the behavior like this:

if (View is ISafeAreaView2 v2) return v2.GetSafeAreaRegionsForEdge(edge);  // internal → MAUI types only
if (View is ISafeAreaView v1) return v1.IgnoreSafeArea ? None : Container; // public, but all-or-nothing
return SafeAreaRegions.None;

So a third-party control can hold a public SafeAreaEdges value, but nothing in the platform layer will ever honor it.

Consequences

1. Custom views cannot express a real strategy. A control deriving from View (not Layout/Border/ScrollView/ContentPage) can only implement the legacy ISafeAreaView, i.e. "obey everything" or "ignore everything". It cannot say "consume the bottom edge only", or use SoftInput semantics, even though its platform view is a MauiView that already implements all of it internally. Adding its own SafeAreaEdges bindable property does not help: the property plumbing (ISafeAreaElement / SafeAreaElement.SafeAreaEdgesProperty) is internal, and reading the shared property on an object that does not implement the internal interface throws from SafeAreaEdgesDefaultValueCreator.

2. Hosts can no longer read the strategy — a regression from net9. Code that embeds a MAUI view inside a native container (custom navigation/tab chrome mounted in a plain UIView) has to know whether that view folds the system inset into its own measure or deliberately goes edge-to-edge, in order to size the container. In net9 the public ISafeAreaView answered that; in net10+ there is no public equivalent, so the host is left inferring the answer from measurement deltas.

Request

For .NET 11:

  • make ISafeAreaView2 public, so custom views can both declare a per-edge strategy and have hosts read it, and
  • ideally make the SafeAreaEdges bindable-property plumbing reusable by third-party controls (public ISafeAreaElement / a shared SafeAreaEdgesProperty), so a custom control gets the same XAML surface as the built-in types.

Restoring at least the level of access that net9's public ISafeAreaView provided would already unblock the hosting scenario; making the per-edge API public is what unblocks custom views.

A public accessor has a second benefit: hosts and custom controls can follow whatever semantics MAUI settles on for SafeAreaRegions.Default (see #34872) instead of hard-coding an interpretation of the enum.

Version

Observed on MAUI 10.0.80 (net10.0-ios); request targets net11.

Activity

  1. added
    area-safearea
    on Aug 13, 2026
  2. added a commit that references this issue on Aug 31, 2026
    92f4887
  3. github-actions commented on Aug 31, 2026

    @github-actions
    Contributor

    Closed by #38039 (merged to net11.0). GitHub only auto-closes for PRs merged to the default branch; this issue was fixed by a PR merged to a non-default branch.

  4. locked and limited conversation to collaborators on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-safearea

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions