dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.13k stars 1.74k forks source link

RadioButton: TextColor for plain Content not working on iOS #18011

Open marco-skizza opened 1 year ago

marco-skizza commented 1 year ago

Description

I have a simple RadioButton on a page:

<?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="MauiRadio8.MainPage">

    <ScrollView>
        <VerticalStackLayout
            HorizontalOptions="Center"
            VerticalOptions="Center"
            Background="Green">

            <RadioButton
                Content="White"
                Value="1"
                TextColor="White" />

        </VerticalStackLayout>
    </ScrollView>

</ContentPage>

On iOS the TextColor is not taken into account: MauiRadio8-iOS On WinUI for example the text appears correctly in white: MauiRadio8-WinUI

Steps to Reproduce

  1. Create a new MAUI app from template
  2. Add the above xml in the MainPage.xaml

Link to public reproduction project repository

https://github.com/marco-skizza/MauiRadioButtonTextColor

Version with bug

8.0.0-rc.2.9373

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

Tested on iPad mini 6, iPadOS 16.7.1

Did you find any workaround?

Even though not so nice, it can be fixed with custom Content:

            <RadioButton
                Value="1">
                <RadioButton.Content>
                    <Label TextColor="White">White</Label>
                </RadioButton.Content>
            </RadioButton>

Relevant log output

No response

XamlTest commented 1 year ago

Verified this on Visual Studio Enterprise 17.8.0 Preview 3.0(8.0.0-rc.2.9373). Repro on iOS 16.4, not repro on Windows 11 and Android 13.0-API33 with below Project: 18011.zip

image

ghost commented 1 year ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

dustin-wojciechowski commented 5 months ago

Looks like this was fixed when I tested it on the latest in main:

simulator_screenshot_09BE77F5-378A-4D8C-841E-6A65749AC276

marco-skizza commented 5 months ago

Thanks @dustin-wojciechowski

With today's nightly build 8.0.60-ci.net8.24272.1 I still experience the issue. But I don't know how you handle the merging of your main, so I'll check back when 8.0.60 is officially out.

Or do you mean it'll be fixed with v9?

dustin-wojciechowski commented 5 months ago

@marco-skizza The nightly builds should reflect what's in main. I tested it again on IPad 16.4 and seems like it's working: simulator_screenshot_8A97BCC8-6199-4B9A-B668-05E7FFD5B611

I just copy pasted the code you had in your description into our "Sandbox" project that allows us to more easily test things. Do you perhaps have any workarounds in place or something that would conflict with this? If it's another issue, such as with Control Template, we can possibly link that to some open issues we're currently investigating.

marco-skizza commented 5 months ago

Hi @dustin-wojciechowski

I created a sample project with which I still experience the issue on 8.0.60-ci.net8.24274.1: https://github.com/marco-skizza/MauiRadioButtonTextColor

Besides, I'm now on:

IMG_0059

dustin-wojciechowski commented 5 months ago

Hmm, now that I've imported your project directly I receive the same behavior. I'm wondering if this is related to an issue we're having with RadioButton and Control Templates... I'll reopen this in the meanwhile while we continue investigation.

kubaflo commented 4 months ago

It works for me with the code from the @marco-skizza repo

<VerticalStackLayout
            HorizontalOptions="Center"
            VerticalOptions="Center"
            Background="Green">

            <RadioButton
                Content="White"
                Value="1"
                TextColor="White" />
</VerticalStackLayout>

Simulator Screenshot - iPhone 15 Pro Max - 2024-06-09 at 11 28 48

marco-skizza commented 4 months ago

Hi

It still doesn't work for me with the code from my repo (see on top of page). I wonder what you are doing different than me...?

Besides, I'm now on:

kubaflo commented 4 months ago

@marco-skizza maybe try to remove explicit styles applied to RadioButton in Styles.xaml

marco-skizza commented 4 months ago

@kubaflo Thanks for the hint. But I already have a workaround in place (see original post). This issue is more for other people, trying to set the text color of the radio button in an new/untouched project.

gktval commented 2 months ago

@marco-skizza maybe try to remove explicit styles applied to RadioButton in Styles.xaml

I commented out the Style for RadioButton, but this is still an issue for me on .NET MAUI: 8.0.70-ci.net8.24312.3.