AutoCompleteBox Not selectedItem down / up key

advertisements

I use AutoCompleteBox in MVVM and i want to execute something only if the user click on the Item or if the user press Enter.

But now when I use the down\Up Key on the keyboard the selectedItem property changes...

My controls :

<Controls:AutoCompleteBox ItemsSource="{Binding IndicationDtos, Mode=TwoWay}"
                              Width="100" SelectedItem="{Binding IndicationSelected, Mode=TwoWay}"
                              ValueMemberPath="Diagnosis" Text="{Binding Criteria, Mode=TwoWay}" MinimumPopulateDelay="250"/>

What can I do to make the property "SelectedItem" is assigned only on Enter or click?

If you have any question...

thanks a lot


In your SelectedItem binding, you can use:

SelectedItem="{Binding IndicationSelected, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"

That way selected item only changes when you focus on something else