How to Filter more than one field using WPF AutoCompleteBox
i 开发者_如何学Pythonam trying to customize the suggestions on the AutoCompleteBox in the WPF Tool kit. Right now i have a last name field which when the user enters characters a query runs that retrieves the top 10 records based on that last name. i would also like to filter by first name, i tried splitting out the comma and searching by the last name and the characters entered in the first name.
however, as soon as a space or comma is entered into the autocompletebox, the suggest functionality stops working, which I believe is because the ValueMemberPath property is set to be last name. Is there a work around for this, or a way to modify the ValueMemberPath to handle multiple values? Thanks!
If you wont get any satisfied answer there's a nice control that I'm using from codeproject that supports searching by keywords with easy API.
WPFAutoCompleteTextbox
There's another simple way to get Autocompletebox accept more than one Property for filtering: just use ValueMemberBinding like this:
ValueMemberBinding="{Binding Converter={StaticResource myConverter}}"
and define "myConverter" so that it concatenates your filter properties (properly separated) into a single string; now your AutocompleteBox will use the whole string as it was a single property.
精彩评论