SfComboBox Selection Box Blank After Selection Until Clear Button Pressed

I'm trying to get Syncfusion SfComboBox (24.2.9) to work in .NET MAUI (8.0.201) for Mac Catalyst with UIDeviceFamily 6.

With IsClearButtonVisible false, the selection box remains blank after making a selection.

With IsClearButtonVisible true, I get the same behavior except the clear button appears after the first selection (with blank selection box). Then if I press the clear button, subsequent selections appear in the selection box.

Please see code below.

I've tried setting ItemsSource in the XAML and specifying TextColor with the same result.

This seems like a bug. Any ideas?

Thanks!

XAML:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:Test"
             xmlns:sfinputs="clr-namespace:Syncfusion.Maui.Inputs;assembly=Syncfusion.Maui.Inputs"
             Shell.NavBarIsVisible="false"
             x:Class="Test.MainPage"
             x:DataType="local:MainViewModel">

    <sfinputs:SfComboBox
        ItemsSource="{Binding BoxTest}"
        IsClearButtonVisible="false" />

    <sfinputs:SfComboBox
        ItemsSource="{Binding BoxTest}" />
    
</ContentPage>

C#:

public partial class MainViewModel : ObservableObject
{

    [ObservableProperty]
    private ObservableCollection<string> boxTest;

    public MainViewModel()
    {
        BoxTest = ["Choice 1", "Choice 2"];
    }

}

5 Replies

KP Kamalesh Periyasamy Syncfusion Team March 15, 2024 11:39 AM UTC

Hi Eggsalad,


After reviewing your query, we would like to inform you that the reported issue occurs due to the Maui framework entry in .NET8.0 for MAC and iOS platforms. In SfComboBox, we have used the Framework Entry for the input field.  We have reported this issue to the Maui framework team, and you can find more details on the issue link below:


Link: Github Issue - 19470


We would like to clarify that the issue arises due to the ComboBox text being updated with the white text color when setting 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).


Currently, We suggested a workaround to resolve the reported issue by setting the text color in the selection changed event as demonstrated in the code snippet below. We have attached the 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,

Kamalesh P


Attachment: ComboBoxSample_e75dbdf4.zip


EG Eggsalad March 16, 2024 08:32 AM UTC

This works! Thanks a lot for the reply!



PR Preethi Rajakandham Syncfusion Team March 18, 2024 06:18 AM UTC

Hi,

You're welcome. Please let us know if you need further assistance. As always, we are happy to help you out. 

Regards,

Preethi R




RK Ravikumar Kanasagra November 19, 2024 01:21 PM UTC

It is not working in the iOS 18. Selected value, placeholder and dropdown icon are not visible. It is working fine on the android environment. Workaround given here does not work for me.

I have updated the nuget "Syncfusion.Maui.Inputs" to latest version="27.2.2" and using MAUI 8. 


My SfComboBox Code - 

<SfControl:SfComboBox

                    x:Name="comboBox"

                    Placeholder="Please select"

                    SelectedIndex="{Binding SelectedIndex}"

                    DisplayMemberPath="Value"

                    DropDownBackground="White"

                    DropDownIconColor="Black"

                    IsClearButtonVisible="False"

                    IsEditable="False"

                    ItemsSource="{Binding Items}"

                    SelectedDropDownItemBackground="Blue"

                    SelectionChanged="ComboBoxSelectionChanged"

                    Stroke="Transparent"

                    PlaceholderColor="Gray"

                    TextColor="Black"/>



HC Hariharan Chokkalingam Syncfusion Team November 20, 2024 01:00 PM UTC

Hi RaviKumar Kanasagra,

 

Regarding your query, we noticed that you have already created a support ticket in Syncfusion. You can follow up on the progress using the ticket link.

If you need any further assistance, please feel free to reach out.

 

Regards,

Hariharan.


Loader.
Up arrow icon