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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:57:36+00:00 2026-05-24T04:57:36+00:00

i am working with the AutoCompleteBox from the WP7 Silverlight Toolkit. i have seen

  • 0

i am working with the AutoCompleteBox from the WP7 Silverlight Toolkit. i have seen examples where they bind a static list (non-changing List) of strings to the AutoCompleteBox. however, is there an example showing how to bind the AutoCompleteBox in a more dynamic way? my attempt below keeps throwing an InvalidOperationException: Cannot change ObservableCollection during a CollectionChanged or PropertyChanged event.

this is what i have in my xaml.

<toolkit:AutoCompleteBox x:Name="tbQuery" TextChanged="tbQuery_TextChanged" />

in my code-behind, i have simulated going to a database or across the web as follows.

    private void tbQuery_TextChanged(object sender, RoutedEventArgs e)
    {
        AutoCompleteBox acBox = sender as AutoCompleteBox;
        string txt = acBox.Text;
        if (txt.Length > 0)
        {
            //exception thrown below here;
            //_words is of type ObservableCollection<string>
            //earlier, acBox.ItemsSource was set to _words
            _words.Clear();
            _words.Add(txt + "a");
            _words.Add(txt + "b");
            _words.Add(txt + "c");
        }
    }

i also tried something like what is below too, but it didn’t work as well. the same InvalidOperationException is thrown.

    private void tbQuery_TextChanged(object sender, RoutedEventArgs e)
    {
        AutoCompleteBox acBox = sender as AutoCompleteBox;
        string txt = acBox.Text;
        if (txt.Length > 0)
        {
            List<string> list = new List<string>();
            list.Add(txt + "a");
            list.Add(txt + "b");
            list.Add(txt + "c");
            //exception thrown below here;
            acBox.ItemsSource = list;
        }
    }

the demo in the toolkit only shows using a static resource, and most examples only show with a static list. is this because AutoCompleteBox is not to be used in a dynamic way?

  • 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-24T04:57:36+00:00Added an answer on May 24, 2026 at 4:57 am

    Exactly what is the point of changing the list on the fly? The autocompletion box filters automatically your list from the given itemssource.

    Anyway, the TextChanged is first called after the AutoCompleteBox have attempted to filter out your items. If you press the back button after having typed in a few characters, you will see your generated items suggested.

    You could most likely reprogram the AutoCompleteBox to your functionality (it’s open source), but I think it would be better if you explained your purpose, so we can advice better.

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

Sidebar

Related Questions

I have a Silverlight Autocompletebox to show a list of staff members, and it
working on xcode I realized that if I create a non-void method, I call
Working in Scala-IDE, I have a Java library, in which one of the methods
Working on a multi-tenant app where most of my models will have a tenant_id
Working on a website http://www.ArenaText.com written in asp.net with Microsoft AJAX control toolkit. iPad
Working on calling a C function from my asm project. I'm trying to push
Working sample using one Table SELECT t.* FROM ( SELECT TITLE.name, (TITLE.value-TITLE.msp) AS Lower,
Working with a Lucene index, I have a standard document format that looks something
Working in Java: I have a JFrame class, and separate classes for my two
Working with SSRS and a SQL 2000 source, I have a stored procedure that

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.