.netmaui

PageOverlayColor not working for Maui CommunityToolkit Popup


I am in the process of updating a .net maui project to .net9 and have not been successful implementing the new popup rewrite using CommunityToolkit 12.1.0. The background around the popup except for the top and bottom navigation and system bars is black, or a shade of black. I set the PageOverlayColor as well as ContentView and ContentPage's color to something other than black but I always get the same shade of black. I know it seems to be overriding somewhere but I have not been able to find the source yet. Has anyone ran into a similar issue and been able to resolve? Thank you.

Note: I know I do not need to set both Background and BackgroundColor but I was just trying everything.

await CurrentPage.ShowPopupAsync(popup, new PopupOptions()
                {
                    PageOverlayColor = Colors.Orange,
                });
...

<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="SmartecConnect.Views.Popups.SimplePopup"
             Background="White"
             BackgroundColor="White">
    <Label Text="This is a very important message!" />
</ContentView>

...

<ContentPage
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:fonts="clr-namespace:SmartecConnect.Resources.Fonts"
    xmlns:views="clr-namespace:SmartecConnect.Views"
    x:Class="SmartecConnect.Pages.MainPage"
    Background="White"
    BackgroundColor="White"
    ControlTemplate="{StaticResource OurLayoutTemplate}">
    ....
</ContentPage>

...

    <ControlTemplate x:Key="OurLayoutTemplate">
        <Grid RowDefinitions="Auto,*,Auto">
            <StackLayout Grid.Row="0">
                <Grid RowDefinitions="60">
                    <Image
                        ... />
                    <Image
                        ... />
                </Grid>
            </StackLayout>

            <ContentPresenter Grid.Row="1" Padding="8, 0"
                              VerticalOptions="Fill"
                              HorizontalOptions="Fill"
                              Background="White"
                              BackgroundColor="White"/>

            <StackLayout Grid.Row="2">
                <Grid RowDefinitions="10" Background="{StaticResource BottomBarGradient}" />
            </StackLayout>
        </Grid>
    </ControlTemplate>


Solution

  • The problem exist in version 12.1.0. The workaround is to use version 12.0.0, it works regularly