Search code examples
c#xamlwindows-phone-8toolkit

why AutoComplete toolkit not updated with new items?


I set Datasource of toolkit:AutoCompleteBox to a list of string items. it work good but when I want add a new item to list then set again the list to Datasource of toolkit:AutoCompleteBox , it is not added. I think Datasource of toolkit:AutoCompleteBox is not updated.

have you any idea on how to add a new item ? or refresh or update list?

List<string> c1 = new List<string>();
//... add some items to c1
txt11.ItemsSource = c1;
c1.Add(txt11.Text.Trim());
txt11.ItemsSource = c1;

Solution

  • Oh my GOD, i found problem easy with this code: i have to assignment again. first time give null to AutoCompleteBox.

    List<string> c1 = new List<string>();
    //... add some items to c1
    txt11.ItemsSource = c1;
    c1.Add(txt11.Text.Trim());
    txt11.ItemsSource = null; 
    txt11.ItemsSource = c1;