void _interval_Elapsed(object sender, ElapsedEventArgs e) { IsKeyEvent = false; // pause the timer this._interval.Stop(); // show the drop down when user starts typing then stops this.Dispatcher.BeginInvoke((Action) delegate { this.IsDropDownOpen = true; // load from event source if (this.PatternChanged != null) { AutoCompleteArgs args = new AutoCompleteArgs(this.Text); this.PatternChanged(this, args); // bind the new datasource if user did not cancel if (!args.CancelBinding) { this.ItemsSource = args.DataSource; if (!this.TypeAhead) { // override auto complete behavior this.Text = args.Pattern; this.EditableTextBox.CaretIndex = args.Pattern.Length; } } } }, System.Windows.Threading.DispatcherPriority.ApplicationIdle); }
void _interval_Elapsed(object sender, ElapsedEventArgs e) { IsKeyEvent = false; // pause the timer this._interval.Stop(); // show the drop down when user starts typing then stops this.Dispatcher.BeginInvoke((Action)delegate { this.IsDropDownOpen = true; // load from event source if (this.PatternChanged != null) { AutoCompleteArgs args = new AutoCompleteArgs(this.Text); this.PatternChanged(this, args); // bind the new datasource if user did not cancel if (!args.CancelBinding) { this.ItemsSource = args.DataSource; if (!this.TypeAhead) { // override auto complete behavior this.Text = args.Pattern; this.EditableTextBox.CaretIndex = args.Pattern.Length; } } } }, System.Windows.Threading.DispatcherPriority.ApplicationIdle); }