示例#1
0
 private void FileSearchFilter_TextChanged(object sender, TextChangedEventArgs e)
 {
     //搜索时触发的数据
     if (!string.IsNullOrEmpty(FileSearchFilter.Text))
     {
         string pattern = FileSearchFilter.Text;
         SetFilesShow(Cache_Files.Where(f =>
                                        f.FileName.Contains(pattern) ||
                                        f.FileNote.Contains(pattern) ||
                                        f.UploadName.Contains(pattern)).ToList());
     }
     else
     {
         SetFilesShow(Cache_Files);
     }
 }
示例#2
0
        private void FileSearchFilter_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                //搜索时触发的数据
                if (!string.IsNullOrEmpty(FileSearchFilter.Text))
                {
                    string pattern = FileSearchFilter.Text;
                    SetFilesShow(Cache_Files.Where(f =>
                                                   f.FileName.Contains(pattern) ||
                                                   f.Description.Contains(pattern) ||
                                                   f.Owner.Contains(pattern)).ToList());
                }
                else
                {
                    SetFilesShow(Cache_Files);
                }

                e.Handled = true;
            }
        }
示例#3
0
 private void textBox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         // 搜索时触发的数据
         if (!string.IsNullOrEmpty(textBox1.Text))
         {
             string pattern = textBox1.Text;
             SetFilesShow(Cache_Files.Where(f =>
                                            f.FileName.Contains(pattern) ||
                                            f.Description.Contains(pattern) ||
                                            f.Owner.Contains(pattern)).ToList());
         }
         else
         {
             SetFilesShow(Cache_Files);
         }
         // 已处理过该值
         e.Handled = true;
     }
 }