I seem to have some troubles with the TextColor of my Entry on iOS when Dark Mode is enabled. Whenever I set the Entry's Enabled state to false, the TextColor turns white and it's not possible to change. I used the following simple code to reproduce this.
Page.xaml
<Entry x:Name="TestEntry" />
Page.xaml.cs
public OnboardingPage()
{
InitializeComponent();
TestEntry.Text = "Testo";
TestEntry.TextColor = Color.Blue;
TestEntry.IsEnabled = false;
}
I am currently using the latest version of Xamarin.Forms. (4.4.0.991640)
Does anybody have an idea what's going wrong here? I don't think this is expected behavior..
Thanks in advance!
In the meanwhile I have found the fix necessary to my question.
Apparently the EntryRenderer on iOS uses uses the default color when legacy color management is enabled and the Entry is disabled. Setting the legacyColorManagement to False on the Entry solves this issue.
XF check for legacycolormanagement https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Extensions/VisualElementExtensions.cs#L15
XF check for TextColor of the Entry https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs#L272
I've added following code to my *Page.xaml and now the colors are rendering correctly: