Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8080471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:25:25+00:00 2026-06-05T16:25:25+00:00

I have a scenario where combobox can have same string values. for exa combo

  • 0

I have a scenario where combobox can have same string values. for exa combo box can have following values in drop down:
“Test”,
“Test1”,
“Test1”,
“Test1”,
“Test2”,

On the basis of selected index I am filling another combobox. My Xaml Looks like:

<Grid >
    <Grid.RowDefinitions>
        <RowDefinition Height="40"></RowDefinition>
    </Grid.RowDefinitions>
    <ComboBox ItemsSource="{Binding Path=ComboList, Mode=OneWay}"
              SelectedIndex="{Binding Path=ComboIndex, Mode=TwoWay}"/ >
</Grid>

ViewModel looks like:

class TestViewModel : INotifyPropertyChanged
{
    private IList<string> _comboList = new List<string>
                                      {
                                          "Test",
                                          "Test1",
                                          "Test1",
                                          "Test1",
                                          "Test2",
                                      };       

    public IList<string> ComboList
    {
        get { return _comboList; }
    }


    private int _comboIndex;

    public int ComboIndex
    {
        get { return _comboIndex; }
        set
        {
            if (value == _comboIndex)
            {
                return;
            }

            _comboIndex = value;
            OnPropertyChanged("ComboIndex");
        }
    }

    private void OnPropertyChanged(string prop)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(prop));
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;
}

Problem I am facing is that SelectedIndex does not get fired incase I am suffling between same string value (like changing value from “Test1” ,present at index 1, to “Test1”, present at index 2.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:25:27+00:00Added an answer on June 5, 2026 at 4:25 pm

    Instead of binding to a List<string>, encapsulate the strings, e.g.

    public class Item
    {
        public Item(string v){ Value = v; }
        public string Value{get; private set;}
    }
    

    and bind to a List<Item>.

    Then amend your Xaml to specify the DisplayMemberPath

    <ComboBox ItemsSource="{Binding Path=ComboList, Mode=OneWay}"  
              DisplayMemberPath="Value"
              SelectedIndex="{Binding Path=ComboIndex, Mode=TwoWay}"/ >  
    

    That worked for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following scenario. I have a combobox where multiple selection is available.
The scenario is almost the same as http://arsalantamiz.blogspot.com/2008/09/binding-datagridview-combobox-column.html . but I can't get it
Following scenario: <ComboBox ItemsSource={Binding Path=Names} SelectedItem={Binding Path=Name, UpdateSourceTrigger=PropertyChanged}> </ComboBox> Names is a string collection
I have scenario where I have to use the same XSD element for different
I have a scenario where I need to do the following in a transaction:
I have a scenario with code like the following: extracted_data = data.map{|row| ((row.some_long_number.to_f) if
I have a combobox of Names. There can be person with similar name. Now
Scenario: I have a list table being populated from a combobox. That list table
I am stuck in a scenario where I can have many game screens, and
I have the following scenario: 1 List which contains the months of the year:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.