public bool FilesFilter(object item) { if (item is FileViewModel fi) { var visible = ExtensionsFilters.Count == 0 || ExtensionsFilters.Contains(fi.Extension); visible &= string.IsNullOrEmpty(FilenameFilter) || fi.Name.ToLowerInvariant().Contains(FilenameFilter); return(visible); } return(false); }
private void FileExtensionButton_Click(object sender, RoutedEventArgs e) { // hide others with unselected extension if (sender is ToggleButton tb && tb.Content is string ext) { if (tb.IsChecked == true) { if (!ExtensionsFilters.Contains(ext)) { ExtensionsFilters.Add(ext); } } else { ExtensionsFilters.Remove(ext); } FilesView.Refresh(); } }