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

  • Home
  • SEARCH
  • 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 6373979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:25:54+00:00 2026-05-25T01:25:54+00:00

To clarify I have a combobox with an observable collection bound to its itemsource

  • 0

To clarify I have a combobox with an observable collection bound to its itemsource property. I want user to be able to type in only items that ar present in the collection. whilst keeping the

    IsTextSearchEnabled="true"

Functionality.
So I’ve been looking online for an example on how to do this. Till now I figured i should use the

    <ComboBox TextInput="cbb1_TextInput" />

Event and then searching the collection. But me feeble attempt’s cant maintain the auto-complete feature, selectedindex gets jumbled and other unwanted behavior. Since I’m quite a noob in wpf I wonder if there are solutions that only use the XAML part?

EDIT:
I tried something like this:

     private void fase1cbb1_KeyUp(object sender, KeyEventArgs e)
     {
        ComboBox cb = (ComboBox)sender;
        bool match = false;
        TextBox tb = (TextBox)cb.Template.FindName("PART_EditableTextBox", cb);
        if (tb.Text.Length > 0)
        {
            foreach (MenuItem MI in cb.Items)
            {
                if (MI.Text.StartsWith(tb.Text))
                {
                    match = true; ;
                }
            }
            if (!match)
            {
                int len = tb.Text.Length;
                if (len > 0)
                {
                    tb.Text = tb.Text.Substring(0, len - 1);
                    tb.SelectionStart = len;

                }
            }
        }
    }

But as soon as there is no match anymore there is no more selected item, and no more autocomplete/textsearch.

thnx for any advice or examples.

SOLUTION:
WPF ComboBox with IsEditable="True" – How can I indicate that no match was found?

  • 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-25T01:25:55+00:00Added an answer on May 25, 2026 at 1:25 am

    If you scroll all the way down to the bottom of the ComboBox documentation on MSDN you’ll find that there’s one very simple possible answer: set your ComboBox.IsEditable to false. The user can still select items in the editor by typing the prefix into the box, but they’ll only be able to enter values that already appear in the list.

    The downside is that you don’t get any of the normal “TextBox”-like behavior, in particular, you can’t copy/paste the selected item out of the combo box. If that’s also an issue for you, let us know, but that is the typical behavior for DropDownList style ComboBoxes in Windows anyway.

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

Sidebar

Related Questions

I have a certain situation I want to clarify for myself, and I would
I have a table with an embedded picture(OLE) coulmn. I Want to be able
If I want to bind something like a combobox in the code-behind I have
I have some questions about vector in STL to clarify..... Where are the objects
UPDATE: To clarify a generic error catcher that catches 404's doesn't have enough granularity
First off, let me clarify the platforms we are using. We have an ASP.NET
for clarity lets say we have students and classes, its a many to many
I just want to clarify one thing. This is not a question on which
I have a set of functions I want to be available to my web
I do have an app that should only be visible in the market for

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.