maui icon indicating copy to clipboard operation
maui copied to clipboard

IOS Contentpage BackgroundColor Transparent not working

Open SteveJML opened this issue 3 years ago • 6 comments

Description

Setting the background color on a contentpage to transparent initially shows correctly then changes to white for light and black for dark mode, this is working correctly on Android.

Steps to Reproduce

  1. create new maui app
  2. add a new content page
  3. set the backgroundcolor in Xaml or C# to transparent

Version with bug

6.0.400 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

IOS 15.5

Did you find any workaround?

No

Relevant log output

No response

SteveJML avatar Jul 05 '22 03:07 SteveJML

Android

Android is correctly showing the contentpage behind the view

IOS

IOS is showing a black screen behind the view

SteveJML avatar Jul 05 '22 04:07 SteveJML

I'm not really clear on what you expect to happen and what actually happens? Could you maybe elaborate a bit more or ideally create a little reproduction project and upload that to GitHub for us to look at? Thank you!

jfversluis avatar Jul 06 '22 08:07 jfversluis

Hi @SteveJML. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Jul 06 '22 08:07 ghost

Hi , im trying to create a base popup page like you see in many IOS apps, i want the top half to be transparent so that you can still partially see the calling view. The pictures i previously uploaded didnt amplify exactly what was happening, ive attached 2 pictures, the Android picture is how i want it to look like, ive set the background colour to Transparent and this is what i expected, when i have the same view on IOS, initially the top half is transparent, then after a second or so it turns either black if i have dark mode set or white for light mode.

I created a new Maui project, i added a contentpage, created a routing to that page, then on the bot click for the counter increase im calling that content page, the results are exactly the same as my project

Here is the android picture, this is what i was expecting to see Android IOS, after approx 1 second the background turns black, im expecting to see part of the view underneath like the android version

IOS 2022-07-06 09_48_58

Ive added the view that lies underneath so you can see what im trying to achieve.

Android2

Hope my objectives are clearer

SteveJML avatar Jul 06 '22 09:07 SteveJML

I can verified this. on IOS, set ContentPage BackgroundColor="Transparent", the color can't be changed with the light and black for dark mode.

kristinx0211 avatar Jul 11 '22 06:07 kristinx0211

Trying to do the exact same thing and have the same problem on iOS.

Update:

Using the following code instead of BackgroundColor="Transparent" is working for me as a workaround.

    <ContentPage.BackgroundColor>
               <Color x:FactoryMethod="FromRgba">
                   <x:Arguments>
                       <x:Int32>0</x:Int32>
                       <x:Int32>0</x:Int32>
                       <x:Int32>0</x:Int32>
                       <x:Int32>1</x:Int32>
                   </x:Arguments>
               </Color>
    </ContentPage.BackgroundColor>

Make sure that the Value for Alpha is <x:Int32>1</x:Int32> or it behaves just like BackgroundColor="Transparent"

kjpou1 avatar Aug 09 '22 12:08 kjpou1

As of this writing setting background to Transparent on a ContentPage does not work on WinUI either. The background of the ContentPage is still white or black.

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="....."
             Background="Transparent"
             >

However, setting background to transparent correctly works on macCatalyst - allowing the content that is underneath to show through.

BenderNK avatar Nov 02 '22 00:11 BenderNK