void this_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (e.NewValue != null)
     {
         ExternalServices.IStore service = e.NewValue as ExternalServices.IStore;
         if (service != null)
         {
             passwordBoxLogin.Password = service.Password;
         }
     }
 }
        private void passwordBoxLogin_PasswordChanged(object sender, RoutedEventArgs e)
        {
            PasswordBox passwordBox = sender as PasswordBox;

            if (passwordBox != null)
            {
                ExternalServices.IStore service = passwordBox.DataContext as ExternalServices.IStore;
                if (service != null)
                {
                    service.Password = passwordBox.Password;
                }
            }
        }
        private void buttonVerifyCredentials_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;

            if (button != null)
            {
                ExternalServices.IStore service = button.CommandParameter as ExternalServices.IStore;
                if (service != null)
                {
                    if (service.VerifyCredentials())
                    {
                        button.Content   = "Login OK";
                        button.IsEnabled = false;
                    }
                    else
                    {
                        button.Content = "Try again";
                    }
                }
            }
        }