How to navigate through autosuggestbox with keyboard controls in uwp?

172 Views Asked by At

I need to navigate through Auto suggest box with keyboard up and down arrows I tried this way of using XYFocusKeyboardNavigation="Enabled" but when I navigate through the suggestions the suggestions are being selected , but I want them to get selected only when I press enter . enter image description here

so this is my UI and that is the auto suggest box my plan is to navigate through those suggestions using keyboard up and down arrow controls when ever i press enter that option should be selcted for example

enter image description here

I should get like that, for all the auto suggest box I have developed my code only remaining is that to navigate through the suggestions and select when ever enter is presssed.

<AutoSuggestBox Name="MyAutoSuggestBox"
                                                            PlaceholderText="Search"
                                                            TextChanged="MyAutoSuggestBox_TextChanged"
                                                            SuggestionChosen="MyAutoSuggestBox_SuggestionChosen"
                                                            Width="150"
                                                            ItemsSource="{x:Bind NotAddedPersons,Mode=OneWay}"
                                                            GotFocus="MyAutoSuggestBox_GotFocus"
                                                            XYFocusKeyboardNavigation="Enabled"
                                                            >
                                                <AutoSuggestBox.ItemTemplate >
                                                    <DataTemplate x:DataType="local:Person">
                                                        <TextBlock Text="{x:Bind Name, Mode=OneWay}"/>
                                                    </DataTemplate>
                                                </AutoSuggestBox.ItemTemplate>
                                            </AutoSuggestBox>

please clear this to me. Thanks in advance

0

There are 0 best solutions below