Few tweaks

Nov 18, 2014 at 5:56 PM
Hi !

Awesome control that works much better than I expected :). Thanks a lot.
I just had to convert it to C# but it's quite easy.

I did a few changes though that you might be interested in :
  • In key down event, I added a test : if the user uses the down arrow and the dropdown is closed, the dropdown is opened instead of selecting the next item. This is the expected behaviour I saw when testing the control with users (at least, you need a way to display the list without changing the text). The dropdown should also open when using the up arrow.
  • If you use the down / up arrows, it moves the Selector SelectedItem and it doesn't update the SelectedItem of AutoCompleteTextBox. I'M OKAY WITH THAT, this is good. BUT, when you leave the control by clicking somewhere else, the AutoCompleteTextBox SelectedItem IS NOT UPDATED (but it is if you use Enter or Tab). It should be updated to reflect the text (again, the user expects that). I added a call to OnSelectionAdapterCommit in OnEditorLostFocus.
  • There is a problem with the cancel event : this is not a real cancel, it just closes the dropdown. The problem is that then the SelectedItem doesn't reflect the text displayed on the control so the user might think it has been selected while it's not. With my change this issue is fixed as when the focus is lost, SelectedItem of the control and the Selector are synchronized.
  • Consequence of the Lost focus change I did : if you select an item, select the text, delete it, the SelectedItem is set to null, this ok. But when losing focus the SelectedItem gets it value back. So, in the SetSelectedItem I added a call to a ResetSelection method in the SelectionAdapter. It sets the SelectorControl.SelectedItem to null / Nothing.
  • I'm trying to have a scrollbar but didn't manage to have that, but it's because I'm pretty bad at XAML :). If you have any idea, I'm interested.
I tried to fit my changes in your code in a clean way as I think it is well though, but you might have a better way to implement those.

Thanks again for that control !
Coordinator
Dec 1, 2014 at 8:38 AM
Hi!

First of all I would like to thank you for your appreciations. I agree with all your suggestions and would incorporate all the suggestions in the control soon.

Where you want the scroll-bars? In the suggestion list? In the control template, you can set the max height of the popup to a desired height and ensure the HorizontalScrollbarVisibility of the ListBox is set to Auto. Vertical scroll bar must appear automatically if all the suggestion items cannot be displayed on the screen.
Coordinator
Dec 1, 2014 at 8:38 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 2, 2014 at 9:33 AM
Hi,

Yes I wanted scrollbars in the suggestion list, but I managed to get it right. Thanks for your answer.

Julien.
Dec 22, 2014 at 10:53 PM
If you use the down / up arrows, it moves the Selector SelectedItem and it doesn't update the SelectedItem of AutoCompleteTextBox. I'M OKAY WITH THAT, this is good. BUT, when you leave the control by clicking somewhere else, the AutoCompleteTextBox SelectedItem IS NOT UPDATED (but it is if you use Enter or Tab). It should be updated to reflect the text (again, the user expects that). I added a call to OnSelectionAdapterCommit in OnEditorLostFocus.
How did you add the OnEditorLostFocus? Having the same problem on this otherwise awesome control!
Jan 5, 2015 at 12:33 PM
Edited Jan 5, 2015 at 12:34 PM
I just added this to the existing OnEditorLostFocus (it's in C#, I can read but not write VB ^^):
OnSelectionAdapterCommit(this, EventArgs.Empty);
And in SetSelectedItem, I added this :
            if (item == null)
                SelectionAdapter.ResetSelection();