private void TenBtnClkNew(object sender, RoutedEventArgs e) { NewTenant = new LokaVerkefniCL.Tenant(); NewAddress = new LokaVerkefniCL.Address(); NewTenant.Address = NewAddress; TenantNew.DataContext = NewTenant; TenNewComboZip.DataContext = ZipViewSource; TenantDisplay.Visibility = Visibility.Collapsed; TenantEdit.Visibility = Visibility.Collapsed; TenantNew.Visibility = Visibility.Visible; }
/// <summary> /// Changing Active Grid to New Apartment /// </summary> private void AptNewaptm(object sender, RoutedEventArgs e) { // Creating a Blank Apartment Variable and asigning it to NewApartment NewApartment = new LokaVerkefniCL.Apartment(); // Creating a Blank Adress and asigning it to NewAdress NewAddress = new LokaVerkefniCL.Address(); // Connecting the blank Adress to the Blank Apartment NewApartment.Address = NewAddress; // Seting NewApartment as the Data context for the New Apartment Grid ApartmentNewApartment.DataContext = NewApartment; // Linking the Zip Combobox to the zip VievSource ApartmentNewApartmentComboBoxZip.DataContext = ZipViewSource; // Hiding the Display Grid and showing the New Apartment Grid ApartmentDisplay.Visibility = Visibility.Collapsed; ApartmentNewApartment.Visibility = Visibility.Visible; }