PopulateComplete() public method

Notifies the T:System.Windows.Controls.AutoCompleteBox that the P:System.Windows.Controls.AutoCompleteBox.ItemsSource property has been set and the data can be filtered to provide possible matches in the drop-down.
Call this method when you are providing custom population of the drop-down portion of the AutoCompleteBox, to signal the control that you are done with the population process. Typically, you use PopulateComplete when the population process is a long-running process and you want to cancel built-in filtering of the ItemsSource items. In this case, you can handle the Populated event and set PopulatingEventArgs.Cancel to true. When the long-running process has completed you call PopulateComplete to indicate the drop-down is populated.
public PopulateComplete ( ) : void
return void
示例#1
0
        void UpdateQueryResults(AutoCompleteBox box, Task<object[]> task, CancellationToken token)
        {
            VerifyAccess();
            //
            // Last chance for cancellation... after this, we know we won't get canceled because cancellation can
            // only happen on this thread.
            //
            if (task.Status != TaskStatus.RanToCompletion || token.IsCancellationRequested) { return; }

            box.ItemsSource = task.Result;
            box.PopulateComplete();
        }