Exemplo n.º 1
0
 private void ExecutePreviewKeyDown(KeyEventArgs kea)
 {
     if (kea.Key == Key.Enter && _unfrozenText.Length > 0)
     {
         bool add = true;
         foreach (var fe in FilterCriteria)
         {
             if (fe.FrozenText.Equals(_unfrozenText))
             {
                 add = false;
             }
         }
         if (add)
         {
             FilterCriteria.Add(new FilterCriteriaVM(_unfrozenText, _filterCritera));
         }
         UnfrozenText = "";
     }
     else if (kea.Key == Key.Back && CaretPosition == 0)
     {
         if (FilterCriteria.Any())
         {
             FilterCriteriaVM fe = FilterCriteria[FilterCriteria.Count() - 1];
             FilterCriteria.RemoveAt(FilterCriteria.Count() - 1);
             UnfrozenText  = fe.FrozenText + _unfrozenText;
             CaretPosition = _unfrozenText.Length;
         }
     }
 }