c# - WPF/Silverlight AutoCompleteBox with ability to add new values to list -


i use autocompletebox list of values, add new values list if user enters 1 isn't present.

i have string property in view model called 'comment'. bound textbox in view - user types comment , view model updated. simple.

to save time, customer autocomplete previous values, way thought like:

viewmodel

public string comment; public observablecollection<string> commentslist { ... } 

(populate commentslist when viewmodel created)

view

<autocompletecombobox itemssource="{binding commentslist}" selecteditem="{binding comment, mode=twoway/> 

so when user selects value, saves value in comment property. works fine if user selects item in list, if user types in new value, comment property not updated (it null because selected item not in list).

is possible autocompletebox?

thanks in advance, will

found solution...

i needed use text property, not selecteditem.

text contains current text user has entered or selected.

selecteditem null if no item selected. if user navigates through drop down, selecting items, or clicks on item, updated item.

see:

http://www.jeff.wilcox.name/2008/10/introducing-autocompletebox/


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -