Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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];
                }
            }
        }