c# - AutocompleteBox validation -



c# - AutocompleteBox validation -

i have autocomplete box in silverlight , bound collection. working fine. want user can't come in values not in collection.

for example: collection contain value "head". if user enters headx or other that, validation should fired.

how this?

regards

arun

try this

<sdk:autocompletebox grid.column="3" grid.row="3" height="18" width="150" istextcompletionenabled="true" tabindex="9" horizontalalignment="left" text="{binding elementname=resedit,path=datacontext.selecteddemotext,mode=twoway}" itemssource="{binding elementname=resedit,path=datacontext.demolist,mode=oneway}" itemtemplate="{staticresource demotemplate}" valuememberpath="democode" lostfocus="autocompletebox_lostfocus" margin="0,0,21,0" padding="0"> </sdk:autocompletebox>

you should not utilize both function selectedtext , selecteditem in autocomplete. it's bug of autocompletebox..... improve way set visiblity of textbox , autocompletebox on gotfocus , lossfocus. way defiantly solve problem

private void demoautocomplete_lostfocus(object sender, routedeventargs e) { demotextbox.visibility = visibility.visible; demoautocomplete.visibility = visibility.collapsed; demotextbox.text = ocrautocomplete.text; ((demovm)this.datacontext).selecteddemotext = demoautocomplete.text; } private void demotextbox_gotfocus(object sender, routedeventargs e) { demoautocomplete.text = octtextbox.text; demotextbox.visibility = visibility.collapsed; demoautocomplete.visibility = visibility.visible; demoautocomplete.focus(); }

c# silverlight

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -