Text renders white with white backgrouind when theme goes dark on MacOs

In my MAUI app, on MacOs, when the theme is changed automatically by the UI at night, the app sfComboBoxes then render white text with a white background. I traised this as a bug, and syncfusion closed it as resolved, .... but I'm still getting the issue. Please sort it out.... or tell me the workaround. 


2 Replies

JT John Taylor January 12, 2024 05:29 PM UTC

I was able to force the colour using the following:


    void PickerComboBox_Loaded(System.Object sender, System.EventArgs e)

    {

        //if (Application.Current.UserAppTheme == AppTheme.Dark)

        //{

#if MACCATALYST

            PickerComboBox.TextColor = Colors.DarkGray;

            PickerComboBox.TextColor = Colors.Black;

#endif

        //}

    }


    void PickerComboBox_SelectionChanged(System.Object sender, Syncfusion.Maui.Inputs.SelectionChangedEventArgs e)

    {

      // if (Application.Current.UserAppTheme == AppTheme.Dark)

      // {

#if MACCATALYST

            PickerComboBox.TextColor = Colors.DarkGray;

            PickerComboBox.TextColor = Colors.Black;

#endif

      // }

    }



BV Brundha Velusamy Syncfusion Team January 15, 2024 07:37 AM UTC

Hi John,


Thank you for reaching out to Syncfusion support.


We would like to convey that the reported issue "The SfComboBox text color is not applied in MacCatalyst Dark Theme" arises due to the ComboBox text being updated with the white text color when setting the dark theme mode. This behavior occurs because the Framework Entry defaults to a white text color when the device settings are set to a dark theme. In .NET 8.0 update in MAUI, we observed this issue occurring in a simple scenario: when an entry has a text color set as red, and when the text is programmatically updated, it changes to the default color (white) instead of the provided color (red).


We have reported this issue to the Maui framework team, and you can find more details on the issue link below:


Link: https://github.com/dotnet/maui/issues/19470


We recommend a workaround to address the reported issue by setting the text color in the selection changed event, as you mentioned. We have attached a sample for your reference. Please review it and let us know the details.


Code Snippet:

private void comboBox_SelectionChanged(object sender, Syncfusion.Maui.Inputs.SelectionChangedEventArgs e)

    {

if (sender is SfComboBox sfComboBox)

{

            sfComboBox.TextColor = Color.FromRgba(0, 0, 0, 0.87);

            sfComboBox.TextColor = Colors.Black;

}

    }


Regards,

Brundha V


Attachment: SfComboBoxSample_52d05736.zip

Loader.
Up arrow icon