private void ButtonCountryCodes_Click(object sender, RoutedEventArgs e) { ListCountryViewModel country_viewmodel = new ListCountryViewModel(); country_viewmodel.Mode = ListCountryViewModel.ModelMode.ListDialog; ListCountryWindow window = new ListCountryWindow(country_viewmodel); window.Owner = this; window.ShowDialog(); }
public ListCountryWindow(ListCountryViewModel view_model) { ViewModel = view_model; InitializeComponent(); //ViewModel.Mode ViewModel.CountriesRS.ExecSql(); GetAll_CountryCodes_Record record = ViewModel.CountriesRS.Find(a => a.CountryCodeID == ViewModel.Input_CountryCodeID); if (record != null) { dataGrid.SelectedItem = record; // werkt nog niet } Loaded += CountriesWindow_Loaded; }
private void ButtonLookupCountryCode_Click(object sender, RoutedEventArgs e) { // Initialize the viewmodel for the country list window. ListCountryViewModel list_model = new ListCountryViewModel { Mode = ListCountryViewModel.ModelMode.LookupDialog, // "LookupDialog" means that the [Select] button will be displayed. Input_CountryCodeID = ViewModel.ShipCountryCode }; ListCountryWindow window = new ListCountryWindow(list_model); window.Owner = this; window.ShowDialog(); if (window.DialogResult == false) { return; } ViewModel.ShipCountryCode = list_model.Output_CountryCodeID; UpdateShipCountryInfo(); }