Share via

XAML/MAUI - How to remove the one-pixel high horizontal line ?

Dave Stone 25 Reputation points
2026-01-27T11:12:29.3233333+00:00

Whilst a long term C# developer I've just started on my journey into Maui to build a mobile app across Android and iOS. To get a feel for the presentation layer and behaviour, before writing any functional code, and using the iOS simulator, I started with AppShell.xaml that looked like this..

<?xml version="1.0" encoding="UTF-8" ?>
<Shell
    x:Class="Milkshake_v2.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:Milkshake_v2"
    xmlns:pages="clr-namespace:Milkshake_v2.Pages"
    Title="Milkshake_v2"
    BackgroundColor="LightPink">
    <TabBar>
        <ShellContent Title="Home" Icon="house.png" ContentTemplate="{DataTemplate pages:Home}"/>
        <ShellContent Title="Menu" Icon="cupsoda.png" ContentTemplate="{DataTemplate pages:Home}"/>
        <ShellContent Title="Rewards" Icon="award.png" ContentTemplate="{DataTemplate pages:Home}"/>
        <ShellContent Title="Profile" Icon="user.png" ContentTemplate="{DataTemplate pages:Home}"/>
    </TabBar>
</Shell>

and my Home.xaml page looked like this:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="Milkshake_v2.Pages.Home" 
             BackgroundColor="lightpink"
             SafeAreaEdges="None"
             Title="Home">
</ContentPage>

and the result on the iOS simulator is this:

User's image

where I have a 1-pixel high dark horizontal line. Initially I thought it was grey, but it seems to be the darker colour of whatever BackgroundColor I choose so in this instance it's a darker pink. I's not present in the Android instance. Ultimately, I'm trying to create this (without the horizontal line).

User's image

(note - I haven't got as far as running it up on a physical device yet)

Q: How do I remove this horizontal line ?

Developer technologies | XAML
Developer technologies | XAML

A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.


Answer accepted by question author

Jack Dang (WICLOUD CORPORATION) 18,720 Reputation points Microsoft External Staff Moderator
2026-01-28T08:06:10.7233333+00:00

Hi @Dave Stone ,

Thanks for reaching out, and thanks for coming back to share what you found.

What you were seeing on iOS isn’t a random rendering glitch. It’s a Shell-specific UI artifact.

When you set a BackgroundColor on the Shell, iOS renders a native container view behind the content (think navigation/tab infrastructure). On iOS, that container includes a very thin separator / edge line between the Shell chrome and the page content. Because of how iOS blends colors, that line often appears as a slightly darker shade of whatever background color you chose which is why it looked like a darker pink and changed color with different themes.

By setting:

<Shell BackgroundColor="Transparent">

you’re essentially telling MAUI:

“Don’t paint the Shell’s background at all, let the page handle it.”

Once the Shell background is transparent, the ContentPage’s BackgroundColor becomes the only visible background, and the iOS container no longer draws that separator line.

A good rule of thumb going forward:

  • Use Shell.BackgroundColor only when you want to style the Shell chrome itself
  • Use ContentPage.BackgroundColor for full-screen page visuals
  • If you want a seamless layout on iOS, keeping the Shell background Transparent is often the safest option

Hope this helps! If my explanation was helpful - kindly follow the instructions here so others with the same problem can benefit as well.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.