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 516255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:42:43+00:00 2026-05-13T07:42:43+00:00

I would like to have a ComboBox control on a form which will be

  • 0

I would like to have a ComboBox control on a form which will be used to search a list of investments as the user types. I can do this easily if I cache the entire collection of investments from the database on startup (currently 3,000 or so items), but I would prefer to not do that if it isn’t necessary.

The behavior that I am trying to implement is:

  • The user types text into the editable ComboBox.
  • As the user enters each character, the database search function is triggered, narrowing down the search results with each successive keystroke.
  • As the search results are updated, the dropdown panel opens and displays the relevant matches

I have tried binding the Text property of the ComboBox to the InvestmentName (string) property on my ViewModel, and the ItemsSource property of the ComboBox to the InvestmentList (generic List) property on my ViewModel. When I do this, the Text property auto-completes from the ItemsSource, however the dropdown appears empty.

I have been able to achieve these results using a TextBox stacked on top of a ListBox, but it isn’t very elegant and it takes up more screen real estate. I’ve also been able to get it to work with a TextBox stacked on top of a ComboBox, although the ComboBox steals the focus when the IsDropDownOpen property is set to “true” when there are valid search items. It also isn’t very visually pleasing to use two controls for this.

I feel like I’m really close to getting it to work the way I want it to, but there is something which eludes me.

The XAML for this control is:

<ComboBox Height="23" Width="260" IsSynchronizedWithCurrentItem="True" HorizontalAlignment="Left"
          ItemsSource="{Binding InvestmentList}" DisplayMemberPath="FullName"
          IsDropDownOpen="{Binding DoShowInvestmentList}"
          ItemsPanel="{DynamicResource ItemsTemplate}" IsEditable="True" 
          Text="{Binding Path=InvestmentName, Mode=TwoWay,
                 UpdateSourceTrigger=PropertyChanged}" />

The relevant ViewModel properties are:

    private bool _doShowInvestmentList;
    public bool DoShowInvestmentList
    {
        get { return _doShowInvestmentList; }
        set { if (_doShowInvestmentList != value) { _doShowInvestmentList = value; RaisePropertyChanged("DoShowInvestmentList"); } }
    }

    private List<PFInvestment> _investmentList;
    public List<PFInvestment> InvestmentList
    {
        get { return _investmentList; }
        set { if (_investmentList != value) { _investmentList = value; RaisePropertyChanged("InvestmentList"); } }
    }

    private string _investmentName;
    public string InvestmentName
    {
        get { return _investmentName; }
        set
        {
            if (_investmentName != value)
            {
                _investmentName = value;
                this.InvestmentList = DataAccess.SearchInvestmentsByName(value).ToList();

                if (this.InvestmentList != null && this.InvestmentList.Count > 0)
                    this.DoShowInvestmentList = true;
                else
                    this.DoShowInvestmentList = false;

                RaisePropertyChanged("InvestmentName");
            }
        }
    }

I’ve done a fair bit of research on this, but I haven’t quite found the answer yet.

  • 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-05-13T07:42:44+00:00Added an answer on May 13, 2026 at 7:42 am

    Check out this great article on CodeProject by… me 🙂

    A Reusable WPF Autocomplete TextBox

    Look towards the end for the Google suggest example, it is similar to what you need, where every keypress triggers another query to the server.

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

Sidebar

Related Questions

I have the following collection which i would like to bind to a combobox:
I would like to show my user control inside row details. I have a
I would like to have a field which is updated on every change(insertion, modification),
I would like to have a regular expression which clears an HTML field when
I would like to have a textbox in a Silverlight app where the user
I would like to create a custom WPF control that inherits from comboBox. So
I have need of a checked combobox control like this one --> DevExpress (I
I have 2 silverlight controls on a form; datagrid which is bound to list
I have a Combobox control on my form (WinForms, .NET 3.5), and its DropDownStyle
I have a JComboBox and would like to have a separator in the list

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.