public ListIngridientViewModel() : base() { listIngridientModel = ListIngridientModel.GetInstance(); listIngridientModel.LoadAllIngridient(); //listDetailImportation = ListDetailImportationModel.GetInstance(); listDetailImportation = new ListDetailImportationModel(); // command init IngridientSelectionChangeCommand = new DelegateCommand <IngridientModel>(SelectedIngridientChange); ShortcutKeysCommand = new DelegateCommand <string>(HandleShortcutKeys); CreateImportationCommand = new DelegateCommand(CreateImportation); CheckoutImportationCommand = new DelegateCommand(CheckoutImportation); PrintImportationCommand = new DelegateCommand(PrintImportation); ClearImportationCommand = new DelegateCommand(ClearImportation); CancelCommand = new DelegateCommand(Cancel); DetailSelectionChangeCommand = new DelegateCommand <DetailImportationItemViewModel>(SelectedDetailChange); RemoveItemCommand = new DelegateCommand <DetailImportationItemViewModel>(RemoveDetailItem); // =============> !!!! [WARNING] DO NOT DELETE THIS CODE !!!! <============== SelectedIndex = 0; SelectedIndex = -1; NotifyChanged("SelectedIndex"); // ==================================> <====================================== }
public IngridientManagementViewModel() : base() { listIngridientModel = ListIngridientModel.GetInstance(); listIngridientModel.LoadAllIngridient(); bufferList = new ObservableCollection <IngridientModel>(listIngridientModel.List); SelectedIngridient = new IngridientModel(); SelectedIngridient = ListIngridient[0]; NotifyIngridientChange(); fieldSearch = "Name"; IngridientSelectionChangeCommand = new DelegateCommand <IngridientModel>(IngridientChange); SearchTextChangeCommand = new DelegateCommand <TextBox>(OnSearchTextChange); AddIngridientCommand = new DelegateCommand(ShowAddIngridientDialog); UpdateIngridientCommand = new DelegateCommand(UpdateIngridient); RemoveIngridientCommand = new DelegateCommand(RemoveIngridient); OpenSearchFilterCommand = new DelegateCommand(ShowSearchFilterDialog); }