Trigger Populating Event in AutoCompleteBox

431 Views Asked by At

I have a Silverlight dialog and it contains an autocompletebox. When the dialog opens I would like the autocompletebox populated with text and the dialog opening with suggestions pre-populated without any user input.

Does anyone know how to do this? I am looking for a way to trigger the populating event.

Thanks.

1

There are 1 best solutions below

0
On

Found the answer to this. You need to set the text in the underlining textbox, and when you do this the autocomplete dropdown box will display. You need to use the VisualTreeHelper to get the textbox. DependencyObject o = VisualTreeHelper.GetChild(autocompleteBox, 0); o = VisualTreeHelper.GetChild(o,0); ((TextBox)(o)).Text = "yourtexthere";