private void _listView_ContextMenuOpening(object sender, ContextMenuEventArgs e) { var selectItems = _listView.SelectedItems; if (!_listViewDeleteMenuItem_IsEnabled) { _listViewDeleteMenuItem.IsEnabled = false; } else { _listViewDeleteMenuItem.IsEnabled = (selectItems != null && selectItems.Count > 0); } _listViewCopyMenuItem.IsEnabled = (selectItems != null && selectItems.Count > 0); _listViewCopyInfoMenuItem.IsEnabled = (selectItems != null && selectItems.Count > 0); _listViewResetMenuItem.IsEnabled = (selectItems != null && selectItems.Count > 0); _listViewPriorityMenuItem.IsEnabled = (selectItems != null && selectItems.Count > 0); if (!_listViewDeleteCompleteMenuItem_IsEnabled) { _listViewDeleteCompleteMenuItem.IsEnabled = false; } else { _listViewDeleteCompleteMenuItem.IsEnabled = _listViewModelCollection.Any(n => n.State == DownloadState.Completed); } _listViewPasteMenuItem.IsEnabled = Clipboard.ContainsSeeds(); }