コード例 #1
0
 protected override void OnTextChanged(TextChangedEventArgs e)
 {
     base.OnTextChanged(e);
     if (!_fuzzyEnable)
     {
         return;
     }
     _keySelectedIndex = -1;
     if (Text.Length < MinTextLenght)
     {
         _listBoxFilter.ItemsSource = null;
         _popupFilter.IsOpen        = false;
         return;
     }
     FuzzySearch?.BeginInvoke(Text, o =>
     {
         Dispatcher.BeginInvoke(new Action(() =>
         {
             var result = FuzzySearch.EndInvoke(o);
             if (result.Item1 == Text)
             {
                 var source = result.Item2 as IEnumerable;
                 _listBoxFilter.ItemsSource = source;
                 _popupFilter.IsOpen        = source != null;
             }
         }));
     }, null);
 }