Partager via


RelayCommand, classe

Une commande dont l'objectif est de transmettre suivre par ses fonctionnalités à d'autres objets en appelant la délègue.La valeur de retour par défaut pour la méthode de CanExecute est « true ».

Hiérarchie d'héritage

System.Object
  Microsoft.TeamFoundation.MVVM.NotifyPropertyChangedDispatcherObject
    Microsoft.TeamFoundation.MVVM.RelayCommand
      Microsoft.TeamFoundation.Controls.WPF.TeamExplorer.DropDownLinkCommand
      Microsoft.TeamFoundation.MVVM.AsyncRelayCommand

Espace de noms :  Microsoft.TeamFoundation.MVVM
Assembly :  Microsoft.TeamFoundation.Controls (dans Microsoft.TeamFoundation.Controls.dll)

Syntaxe

'Déclaration
Public Class RelayCommand _
    Inherits NotifyPropertyChangedDispatcherObject _
    Implements IOwnedCommand, ICommand
public class RelayCommand : NotifyPropertyChangedDispatcherObject, 
    IOwnedCommand, ICommand

Le type RelayCommand expose les membres suivants.

Constructeurs

  Nom Description
Méthode publique RelayCommand(Action) Crée une nouvelle commande qui peut toujours exécuter.
Méthode publique RelayCommand(Action<Object>) Crée une nouvelle commande qui peut toujours exécuter.
Méthode publique RelayCommand(Action<Object>, Predicate<Object>) Crée une nouvelle commande.

Début

Propriétés

  Nom Description
Propriété publique Dispatcher Répartiteur associé à cet objet. (Hérité de NotifyPropertyChangedDispatcherObject.)
Propriété publique IsExecuting True si la commande exécute, false.

Début

Méthodes

  Nom Description
Méthode protégée AddDependencySource(String, INotifyCollectionChanged) (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode protégée AddDependencySource(String, INotifyPropertyChanged) (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode publique CanExecute
Méthode publique CheckAccess (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode publique CheckAccessBeginExecute Exécute l'action spécifiée sur un thread associé avec le répartiteur de l'objet. Il appelle un BeginInvoke sur le répartiteur, n'attend pas l'action de fin -- est retourné immédiatement. (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode publique CheckAccessExecute(Action) Exécute l'action spécifiée sur un thread associé avec le répartiteur de l'objet. (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode publique CheckAccessExecute<TResult>(Func<TResult>) (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode publique Equals Détermine si l'objet spécifié est identique à l'objet actuel. (Hérité de Object.)
Méthode publique Execute
Méthode protégée Finalize Autorise un objet à tenter de libérer des ressources et d'exécuter d'autres opérations de nettoyage avant qu'il ne soit récupéré par l'opération garbage collection. (Hérité de Object.)
Méthode protégée GetDependencySourceName(INotifyCollectionChanged) (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode protégée GetDependencySourceName(INotifyPropertyChanged) (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode publique GetHashCode Sert de fonction de hachage pour un type particulier. (Hérité de Object.)
Méthode publique GetType Obtient le Type de l'instance actuelle. (Hérité de Object.)
Méthode protégée MemberwiseClone Crée une copie superficielle de l'objet Object actuel. (Hérité de Object.)
Méthode publique RaiseCanExecuteChanged
Méthode protégée RaisePropertyChanged Événement PropertyChanged de raise.Cette méthode peut être appelée sur le thread associé avec le répartiteur de cet objet. (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode protégée ReceiveWeakEvent (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode protégée RemoveDependencySource(String, INotifyCollectionChanged) (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode protégée RemoveDependencySource(String, INotifyPropertyChanged) (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode protégée SetAndRaisePropertyChanged(Boolean%, Boolean, String) Une méthode d'assistance qui valeur de propriété définit et événement PropertyChanged de raise si la valeur a changé. Implémentation optimisée pour le type de System.Boolean. (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode protégée SetAndRaisePropertyChanged(Int32%, Int32, String) Une méthode d'assistance qui valeur de propriété définit et événement PropertyChanged de raise si la valeur a changé. Implémentation optimisée pour le type System.Int32. (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode protégée SetAndRaisePropertyChanged(String%, String, String) Une méthode d'assistance qui valeur de propriété définit et événement PropertyChanged de raise si la valeur a changé. Implémentation optimisée pour le type chaîne. (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode protégée SetAndRaisePropertyChanged<T>(T%, T, String) Une méthode d'assistance qui valeur de propriété définit et événement PropertyChanged de raise si la valeur a changé. (Hérité de NotifyPropertyChangedDispatcherObject.)
Méthode publique ToString Retourne une chaîne qui représente l'objet actif. (Hérité de Object.)
Méthode protégée VerifyAccess Garantit que le thread appelant a accès à cet objet. (Hérité de NotifyPropertyChangedDispatcherObject.)

Début

Événements

  Nom Description
Événement public CanExecuteChanged Déclenché lorsque CanExecute change.
Événement public PropertyChanged Se produit en cas de modification d'une valeur de propriété. (Hérité de NotifyPropertyChangedDispatcherObject.)

Début

Champs

  Nom Description
Champ publicMembre statique IsExecutingProperty

Début

Implémentations d'interface explicite

  Nom Description
Implémentation d'interface expliciteMéthode privée IWeakEventListener.ReceiveWeakEvent (Hérité de NotifyPropertyChangedDispatcherObject.)

Début

Sécurité des threads

Tous les membres static (Shared en Visual Basic) publics de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

Voir aussi

Référence

Microsoft.TeamFoundation.MVVM, espace de noms