dotnet / dotnet/maui

TitleView inside a NavigationPage has a top margin when page has UseSafeArea="False"

Open
#28,293 3 comments 1 reaction 0 assignees View on GitHub
area-controls-titleview s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

When we have a NavigationPage with a ContentPage that has a TitleView and UseSafeArea=False, the TitleView doesn't render properly. Instead of rendering on the full height that it should render, there's a small Padding/Margin on the top, leaving an empty line that cannot be removed/colored.

### Steps to Reproduce

1. Use regular NavigationPage navigation and not Shell (haven't tested in a Shell nav)
2. Push a new ContentPage
3. Set the ContentPage's status bar color to some value (not needed to reproduce the bug, but is easier for debugging)
4. Add a TitleView in the xaml code (probably will happen in the code-behind as well). Set the TitleView's color to some other value
5. Set `iOsSpecific:Page.UseSafeArea="False"` for the whole page

Expected result:
The TitleView will render fully, taken the whole height available.
The image below is taken with UseSafeArea=True:
![Image](https://github.com/user-attachments/assets/3f2f32f7-f5e0-4ad2-9933-20e1e1f75698)

Actual result:
The TitleView renders with a transparent/white horizontal line above it
The image below is taken with UseSafeArea=False:
![Image](https://github.com/user-attachments/assets/feeaef3c-647a-4bcb-97d7-4668fb2c9d81)

P.S. I also think that setting the TitleView's background color should color the full content of the TitleView (and not leave some spaces on the left & right side), but that's probably a separate bug.

### Link to public reproduction project repository

https://github.com/mduchev/DemoTitleView

### Version with bug

9.0.40 SR4

### Is this a regression from previous behavior?

Not sure, did not test other versions

### Last version that worked well

Unknown/Other

### Affected platforms

iOS

### Affected platform versions

iOS

### Did you find any workaround?

No workaround that I could think of

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Research direction

Start with the linked DemoTitleView reproduction project and reproduce the issue on iOS using a NavigationPage, ContentPage TitleView, and UseSafeArea="False". Trace the TitleView layout and safe-area handling, then verify that the TitleView fills the available height without the top line; the reported left and right background spaces are noted as a possible separate issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, ios
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.