/// <summary> /// Raises the Populated event when the AutoCompleteBox has populated the /// selection adapter with suggestions based on the text property. /// </summary> /// <param name="e">The populated event data.</param> protected virtual void OnPopulated(PopulatedEventArgs e) { PopulatedEventHandler handler = Populated; if (handler != null) { handler(this, e); } }
/// <summary> /// Notifies AutoCompleteBox that ItemsSource has been populated and /// suggestions can now be computed using that data. /// </summary> /// <remarks> /// Allows a developer to continue the population event after setting /// the Cancel property to True. This allows for custom, /// developer-driven AutoCompleteBox scenarios. /// </remarks> public void PopulateComplete() { // Apply the search filter RefreshView(); // Fire the Populated event containing the read-only view data. PopulatedEventArgs populated = new PopulatedEventArgs(new ReadOnlyCollection <object>(View)); OnPopulated(populated); if (SelectionAdapter != null && SelectionAdapter.ItemsSource != View) { SelectionAdapter.ItemsSource = View; } IsDropDownOpen = UserCalledPopulate && (View.Count > 0); if (IsDropDownOpen) { ArrangePopup(); } UpdateTextCompletion(UserCalledPopulate); }