Link to home
Start Free TrialLog in
Avatar of mathew_s
mathew_s

asked on

AutoComplete Box Issue

The problem is that when populating the data in a form based on the autocomplete box, it will display the wrong information if the first name and last name are the same even though they are 2 different people with different employee numbers. It works for all other cases. I did some tests and changed first name and also last name and then it will populate the correct user.  So it looks like it is matching on first name and last name but I want it to populate form based on employee number instead of first name+last name.

What to do?
The code below is the particular autocomplete box that is giving me issues.
Also what method is executing when you make the selection in the dropdown list?? I believe this is where the issue may be.

Please help.

<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Right">
 <TextBlock Text="Observer Name" Style="{StaticResource TextBlockLabelStyle}"/>
 <TextBlock Style="{StaticResource TextBlockRequiredFieldIndicator}"/>
 </StackPanel>
 <sdk:AutoCompleteBox Grid.Row="0" Grid.Column="1" x:Name="acbObservers"
 MinimumPrefixLength="1"
 hu:AsyncAutoCompleteBoxService.ItemsSource="{Binding Observers}"
 hu:AsyncAutoCompleteBoxService.PopulateCommand="{Binding PopulateObserversCommand}"
 SelectedItem="{Binding EditingItem.Observer, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnNotifyDataErrors=True, Converter={StaticResource userToEmployeeConverter}}"
 IsEnabled="{Binding EditingItem.IsNew}">
 <sdk:AutoCompleteBox.ItemTemplate>
 <DataTemplate>
 <StackPanel Orientation="Horizontal">
 <TextBlock hu:TextBlockHighlightService.Text="{Binding FullNameWithEmployeeNumberAndLanID}"
 hu:TextBlockHighlightService.HighlightText="{Binding SearchText, ElementName=acbObservers}"
 Style="{StaticResource TextBlockLabelStyle}"/>
 </StackPanel>
 </DataTemplate>
 </sdk:AutoCompleteBox.ItemTemplate>
 </sdk:AutoCompleteBox>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mathew_s
mathew_s

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial