public void CheckSelectAllOrSelectPos(int pos) { if (FileListBox.Items.Count > pos) { if (SelectAllCheckBox.IsChecked ?? false) { FileListBox.SelectAll(); } else { FileListBox.UnselectAll(); FileListBox.SelectedIndex = pos; } } }
private void SelectAllButton_Click(object sender, RoutedEventArgs e) { if (FileListBox.Items.Count == 0) { return; } if (FileListBox.SelectedItems.Count == 0) { FileListBox.SelectAll(); } else { FileListBox.UnselectAll(); } }
/// <summary> /// Fills the List Box with the Dynamo Files everytime the SelectedFolder Changes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FillFileListBox(object sender, System.Windows.Controls.TextChangedEventArgs e) { try { selectedDirectory = this.selectedDirectoryLabel.Text; string directory = selectedDirectory; string[] files = Directory.GetFiles(directory, "*.dyn"); this.FileListBox.Items.Clear(); foreach (string file in files) { string fileName = Path.GetFileName(file); FileListBox.Items.Add(fileName); } FileListBox.SelectAll(); } catch { } }
/// <summary> /// ファイル全選択ボタン押下時 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnClickAllSelect(object sender, RoutedEventArgs e) { FileListBox.SelectAll(); FileListBox.Focus(); }