locked
Problem in selecting item in combobox

    Question

  • Hi Everyone,

                I have the comobobox in in my app dashboard. That is, in dashboard there gridview to show the list of customers.

    And there is one combobox, to filter the customer by name. And i add one item as "All" in first position of the combobox item list.

    Now the problem is When i select the other items it working fine. but when i select the first item "All", the text is not visible in

    combobox. Functionality is working fine. UI only the problem.

    The screenshots are:

    Please give me the solution.

    Friday, October 17, 2014 5:52 AM

All replies

  • What language (VB? C++? JavaScript?) and UI (HTML? Xaml? DirectX?) are you using so we can help you find the right forum?

    Providing more details of what you're doing and comparing the actual behavior with the desired behavior will likely help as well.

    Friday, October 17, 2014 6:22 AM
    Owner
  • C# , XAML
    Friday, October 17, 2014 6:23 AM
  • Please provide more details of what you're doing and explain the difference between desired behavior and the actual behavior.

    Friday, October 17, 2014 6:36 AM
    Owner
  • Actually I m getting list of customer from API.

    that is:

     Datum horsedata = new Datum();
                lstHorseData.Clear();
                App.lstComboBox.Clear();
                lstCmbxHorseData.Clear();
    
                    var rootData = JsonConvert.DeserializeObject<RootObject>(value);
                    horsedata.horse_name = "All";
                    lstCmbxHorseData.Add(horsedata);
    
     foreach (var returnData in rootData.data)
                    {
                        horsedata = new Datum();
                        horsedata.horse_id = returnData.horse_id.ToString();
                        horsedata.horse_name = returnData.horse_name.ToString();
                        lstCmbxHorseData.Add(horsedata);
                    }
    
     cmbxHorselst.ItemsSource = lstCmbxHorseData;
                cmbxHorselst.SelectedIndex = 0;

    Comobobox :

      <ComboBox  
                                x:Name="cmbxHorselst" HorizontalAlignment="Stretch" Grid.Column="2" 
                                DisplayMemberPath="horse_name"   Height="50"  SelectedValuePath="horse_id"
                                SelectionChanged="searchHorse" />

    Selectionchanged Event:

     ComboBox value = sender as ComboBox;
                    if (value.SelectedValue != null)
                    {
                        horseId = value.SelectedValue.ToString();
                        itemListView.ItemsSource = new ObservableCollection<Datum>(lstHorseData.Where(i => i.horse_id == horseId).ToList());
                    }
                    else
                        itemListView.ItemsSource = lstHorseData;


    Friday, October 17, 2014 6:47 AM
  • Please explain the difference between the desired behavior and the actual behavior.

    We can't help if you don't clearly explain what is going wrong.

    Wednesday, October 22, 2014 11:30 PM
    Owner