private void SelectContactMethod(object parameter) { _selectedContact = parameter as CompanyContact; if (_selectedContact != null) { View.ContactsPhonesGrid.ItemsSource = _selectedContact.ContactPhones; } else { View.ContactsPhonesGrid.ItemsSource = null; } RemoveContactCommand.RaiseCanExecuteChanged(); AddContactPhoneCommand.RaiseCanExecuteChanged(); RemoveContactPhoneCommand.RaiseCanExecuteChanged(); }
private void RemoveContactMethod(object parameter) { if (_selectedContact != null) { Model.Contacts.Remove(_selectedContact); _selectedContact = null; AddContactPhoneCommand.RaiseCanExecuteChanged(); RemoveContactPhoneCommand.RaiseCanExecuteChanged(); // needed becuase SelectionChanged event is not raised by the grid // properly if (Model.Contacts.Count > 0) { View.ContactsGrid.SelectedItem = null; View.ContactsGrid.SelectedItem = Model.Contacts[0]; } } }
private void SelectContactPhoneMethod(object parameter) { _selectedContactPhone = parameter as CompanyContactPhone; RemoveContactPhoneCommand.RaiseCanExecuteChanged(); }