Skip to content

Another Text Color issue #17818

Description

@imsam67

Description

I've already filed another bug pertaining to setting the text color -- here's the link to that issue #17413. This one is different and kind of hard to reproduce but it seems to be affecting text color in an Entry as well as a items within a CollectionView.

I have two pages in my app that contain simple forms to collect data from the user. In both cases, I'm using identical XAML. In the case of the second form, I just can't seem to get the text color to be what I want in an Entry control -- see screen shot. If you look carefully, you'll see that the text is there but it's white so it's almost invisible.

edit_name_form

Here's the XAML for this:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:vm="clr-namespace:MyApp.ViewModels.Settings"
             x:Class="MyApp.Views.Settings.EditMemberName"
             x:DataType="vm:EditMemberNameViewModel"
             Title="Editing Your Name">
    <Grid
        RowDefinitions="70,70,70,*"
        RowSpacing="10"
        Padding="7"
        VerticalOptions="StartAndExpand">

        <!-- 0:First Name -->
        <Grid
            Grid.Row="0"
            RowDefinitions="20,*">
            <Label
                Grid.Row="0"
                Text="First Name"
                TextColor="{StaticResource FormElementTitle}"
                FontFamily="CenturyGothicRegular"
                FontAttributes="Bold"
                CharacterSpacing="1.1"
                VerticalOptions="Center"/>
            <Border
                Grid.Row="1"
                BackgroundColor="{StaticResource White}"
                Stroke="{StaticResource UIMidGray}"
                StrokeThickness="1"
                StrokeShape="RoundRectangle 5">
                <Entry
                    Text="{Binding FirstName}"
                    TextColor="{StaticResource Gray900}"
                    BackgroundColor="{StaticResource FormElementBackground}"
                    FontFamily="CenturyGothicRegular"
                    FontAttributes="Bold"
                    FontSize="13"
                    CharacterSpacing="1.1" />
            </Border>
        </Grid>

        <!-- 1:Middle Name -->
        <Grid
            Grid.Row="1"
            RowDefinitions="20,*">
            <Label
                Grid.Row="0"
                Text="Middle Name"
                TextColor="{StaticResource FormElementTitle}"
                FontFamily="CenturyGothicRegular"
                FontAttributes="Bold"
                CharacterSpacing="1.1"
                VerticalOptions="Center"/>
            <Border
                Grid.Row="1"
                BackgroundColor="{StaticResource White}"
                Stroke="{StaticResource UIMidGray}"
                StrokeThickness="1"
                StrokeShape="RoundRectangle 5">
                <Entry
                    Text="{Binding MiddleName}"
                    TextColor="{StaticResource Gray900}"
                    BackgroundColor="{StaticResource FormElementBackground}"
                    FontFamily="CenturyGothicRegular"
                    FontAttributes="Bold"
                    FontSize="13"
                    CharacterSpacing="1.1" />
            </Border>
        </Grid>

        <!-- 2:Last Name -->
        <Grid
            Grid.Row="2"
            RowDefinitions="20,*">
            <Label
                Grid.Row="0"
                Text="Last Name"
                TextColor="{StaticResource FormElementTitle}"
                FontFamily="CenturyGothicRegular"
                FontAttributes="Bold"
                CharacterSpacing="1.1"
                VerticalOptions="Center"/>
            <Border
                Grid.Row="1"
                BackgroundColor="{StaticResource White}"
                Stroke="{StaticResource UIMidGray}"
                StrokeThickness="1"
                StrokeShape="RoundRectangle 5">
                <Entry
                    Text="{Binding LastName}"
                    TextColor="{StaticResource Gray900}"
                    BackgroundColor="{StaticResource FormElementBackground}"
                    FontFamily="CenturyGothicRegular"
                    FontAttributes="Bold"
                    FontSize="13"
                    CharacterSpacing="1.1" />
            </Border>
        </Grid>

        <!-- 3:Submit Button -->
        <Button
            Grid.Row="3"
            Text="Submit"
            FontAttributes="Bold"
            Command="{Binding EditMemberNameCommand}"
            WidthRequest="150"
            HorizontalOptions="Center"
            VerticalOptions="EndAndExpand"
            Margin="0,20,0,0"/>

    </Grid>
</ContentPage>

As I mentioned before, I have another page with a form in it using the same exact syntax and the text color inside Entry control is exactly what I set it to which is Gray900.

I'm also seeing this erratic behavior in CollectionView items. In some CollectionView's items display perfectly fine while in others the text again is white even though it's set to a specific color. At first glance, it looks as if text is missing but in close examination, one can see that the text is there but white against white makes it almost impossible to see it. Because my background color for my pages is never pure white, when I look carefully, I can still detect the text. This is identical to the screen shot I posted earlier.

Steps to Reproduce

As I mentioned earlier, this is hard to reproduce because I can't even reproduce consistently within the same app. In one page, it works fine but in the other page, it doesn't.

Nevertheless, I wanted to open up another issue pertaining to text color in case others see some unusual behavior in their apps as well.

Link to public reproduction project repository

No response

Version with bug

8.0.0-rc.1.9171

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

7.0.92

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

Haven't found a workaround yet.

Relevant log output

No response

Metadata

Metadata

Labels

area-xamlXAML, CSS, Triggers, Behaviorsplatform/iospotential-regressionThis issue described a possible regression on a currently supported version., verification pendingt/bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions