private void MenuItem_Click_ByPriority(object sender, RoutedEventArgs e) { _saveToOrReadFrom = new SaveToOrReadFrom(Path); _filterIOService = new SaveToOrReadFrom(FilterPath); _filterService = new FilterService(); MenuItem menuItem = (MenuItem)sender;//определение по какой категории будет фильтр try { toDoL.ItemsSource = _filterService.FilterBy("By Priority", _toDoData, menuItem.Header.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); Close(); throw; } }