Using the XamComboEditor with CustomValueEnteredAction="Allow"
How can I bind a field to the text entered? We would like to use that text for an external search if it does not match any of the items within the list
Hello Patrick,
I have been looking into your question and created a small sample with a XamComboEditor that allows custom value to be entered.
In order to retrieve the text from code, my suggestion is to set the CustomValueEnteredAction property to “Add” instead of “Allow” and then handle the ItemAdding event of the XamComboEditor. There you could bind a member of your ViewModel or any other field to the e.Item.Data object, which contains the entered value. You would then cancel the event in order not to add the entered item to the XamComboBox’s Items source.
private void XamComboEditor_ItemAdding(object sender, Infragistics.Controls.Editors.ComboItemAddingEventArgs<Infragistics.Controls.Editors.ComboEditorItem> e) { this.vm.TextFromXamComboEditor = e.Item.Data.ToString(); e.Cancel = true; }
I have attached a sample application, that uses the approach from above. If you require any further assistance on the matter, please let me know.
Sincerely,
Bozhidara Pachilova
Associate Software Developer
7510.XCEEnteredText.zip