wpftoolkit - how to bind an autocompletebox with a model in mvvm? -
wpftoolkit - how to bind an autocompletebox with a model in mvvm? -
i exposed collection , binded itemsource of autocompletebox works selecting or changing text on autocompletebox doesn't update model textbox or label!
viewmodel:
public observablecollection<string> symptomsdb { get; private set; } private string symptom; public string symptom { { homecoming symptom; } set { symptom = value; raisepropertychanged(() => this.symptom); } } public analysisviewmodel() { list<string> s = new list<string>(); s.add("test"); symptomsdb = new observablecollection<string>(s); }
view:
<controls:autocompletebox itemssource="{binding symptomsdb}" selecteditem="{binding symptom}" text="{binding symptom}" istextcompletionenabled="true" filtermode="contains"/>
to alter user interface viewmodel, need bind property twoway (except properties textbox.textproperty twoway default):
<controls:autocompletebox itemssource="{binding symptomsdb}" selecteditem="{binding symptom, mode=twoway}" text="{binding symptom}" istextcompletionenabled="true" filtermode="contains"/>
mvvm wpftoolkit
Comments
Post a Comment