Unable to bind DataSource, list remains empty

Hi,

I'm trying out this control because I like the potential it has, however I'm struggling to get the items in my dropdown.


In my ViewModel constructor I have this :

LanguageList = new ObservableCollection<Language>(Static_Functions.GetLanguageList());            OnPropertyChanged(nameof(LanguageList));

if (Static_Functions.CurrentLocalSettings != null && !String.IsNullOrWhiteSpace(Static_Functions.CurrentLocalSettings.LanguageCode))

            {

                SelectedLanguage = LanguageList.Where(l => l.Code == Static_Functions.CurrentLocalSettings.LanguageCode).FirstOrDefault();

            }

if (SelectedLanguage == null)

            SelectedLanguage = LanguageList.Where(l => l.Code == "us").FirstOrDefault();

OnPropertyChanged(nameof(SelectedLanguage));


My Language class is very simple

public class Language

    {

        public String Code { get; set; }

        public String Name { get; set; }

    }


And this is my declaration :


<StackLayout VerticalOptions="Start" HorizontalOptions="Start" Padding="10" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4">

                    <Label Text="Language" Style="{StaticResource labelStyle}"/>

                    <combobox:SfComboBox x:Name="cboLanguage" ShowBorder="False" HeightRequest="40"

                   DataSource="{Binding LanguageList}" DisplayMemberPath="Name" SelectedItem="{Binding SelectedLanguage,Mode=TwoWay}" TextColor="White"/>

                </StackLayout>


Whatever I try, my combobox does not show any items in the list to select from.

I just wanted to use this control to have a Language Selector in my app.


1 Reply

SS Suganya Sethuraman Syncfusion Team December 9, 2021 06:44 AM UTC

Hi Sven,

Greetings from Syncfusion.

We have checked the reported issue, but we were unable to reproduce the reported issue.

Please have a sample for your reference,

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SfComboBoxDropdown477819408

Since we are not aware of your exact application scenario, so we request you to check the issue with the attached sample and let us know whether it is reproduced or not? If the issue was not reproduced in this sample, please revert us by modifying the sample based on your application along with replication procedure or provide the sample. It will help us to provide better solution at the earliest.

Regards,
Suganya Sethuraman.
 


Loader.
Up arrow icon