c# - WPF AutoComplete TextBox binding allow value that is not in the source list -
currently struggling wpf autocomplete textbox, part of extended toolkit. using autocomplete textbox in property grid :
public class customvalueeditor : xceed.wpf.toolkit.propertygrid.editors.itypeeditor { public frameworkelement resolveeditor(propertyitem propertyitem) { system.windows.controls.autocompletebox autotextbox = new system.windows.controls.autocompletebox(); var _binding = new binding("value") //bind value property of propertyitem { source = propertyitem, validatesonexceptions = true, validatesondataerrors = true, mode = propertyitem.isreadonly ? bindingmode.oneway : bindingmode.twoway }; bindingoperations.setbinding(autotextbox, system.windows.controls.autocompletebox.selecteditemproperty, _binding); autotextbox.itemssource = staticcustomclass.getvalues(); return autotextbox; } }
and editor property :
private string _value = ""; [datamember] [displayname("value")] [category("definition")] [editor(typeof(customvalueeditor),typeof(customvalueeditor))] public string value { => _value; set { _value = value; raisepropertychanged("value");}
my problem that, when enter text not staticcustomclass.getvalues() - property not set. want autocomplete textbox suggest input, allow input free text. can please me direction on how solve this? or maybe there workaround autocomplete textbox disable 'validation' ?
thanks in advance!
Comments
Post a Comment