How to make WPF AutoCompleteBox accept more than one Propert

Jun 24 2018 2:47 AM
I want to search in multiple fields in AutoCompleteBox, I want to search in ClientName if the user starts typing characters, and search in ClientNumber if the user starts typing numbers.
 
I searched on the internet and from this Answer I understand that I should use Converter to accomplish what I want, But unfortunately, they do not explain how can I write the converter!
  1. <toolkit:AutoCompleteBox x:Name="txbClientName" FilterMode="StartsWith" IsTextCompletionEnabled="True" ItemsSource="{Binding ocClients}" ValueMemberBinding="{Binding Converter= {StaticResource ClientSearch}}" SelectedItem="{Binding ElementName=this, Path=ContactPerson, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" PreviewKeyUp="txbClientName_PreviewKeyUp" LostFocus="txbClientName_LostFocus">  
  2. <toolkit:AutoCompleteBox.ItemTemplate>  
  3. <DataTemplate>  
  4. <StackPanel Orientation="Horizontal">  
  5. <Label Content="{Binding ContactPerson}"/></StackPanel>  
  6. </DataTemplate>  
  7. </toolkit:AutoCompleteBox.ItemTemplate>  
  1. public class ClientSearchConverter : IValueConverter  
  2. {  
  3. public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)  
  4. {  
  5. //What should I write here !!!  
  6. }  
  7. public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)  
  8. {  
  9. throw new System.NotImplementedException();  
  10. }  
  11. }  
Any Help