private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { TabControl tc = (TabControl)sender; TabItem item = (TabItem)tc.SelectedItem; if (item.Name == "RecepTab") { DocTypeBox.SelectedIndex = 1; ApcTypeBox.SelectAll(); DocStatutBox.SelectedIndex = 2; AutoLoadCheckBox.IsChecked = true; FournFiltreGrid.IsEnabled = false; DateLivBox.SelectedIndex = 0; Acheteur.SelectedIndex = 0; ViewModel.DateLivFrom = null; ViewModel.DateLivTo = null; ViewModel.DateDocFrom = null; } else { FournFiltreGrid.IsEnabled = true; AutoLoadCheckBox.IsChecked = false; } ViewModel.SelectedTab = item.Name; }
public MainWindow() { InitializeComponent(); //DocStatutBox.SelectAll(); ApcTypeBox?.SelectAll(); //ApcTypeBox.SelectedIndex = 0; //ApcTypeBox.IsEnabled = true; }
private void DocTypeBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox listBox = (ListBox)sender; // Empêche de ne rien sélectionner if (listBox.SelectedItems.Count == 0) { listBox.SelectedIndex = 0; } if (ApcTypeBox != null) { ApcTypeBox.IsEnabled = (listBox.SelectedItems.Count == 1 && listBox.SelectedIndex == 0); } ApcTypeBox?.SelectAll(); DocStatutBox?.SelectAll(); ViewModel.SelectedCommandeTypes = (from KeyValuePair <CommandeType, string> item in listBox.SelectedItems select item.Key).ToList(); }