Show / Hide Table of Contents

Class RelayCommand

Describe un comando estándar de implementación común bajo el paradigma MVVM en Wpf.

Inheritance
object
RelayCommand
Implements
ICommand
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Component
Assembly: MCART.Wpf.Mvvm.dll
Syntax
public class RelayCommand : ICommand

Constructors

| Edit this page View Source

RelayCommand(Action<object?>)

Inicializa una nueva instancia de la clase RelayCommand.

Declaration
public RelayCommand(Action<object?> action)
Parameters
Type Name Description
Action<object> action

Comando a ejecutar.

| Edit this page View Source

RelayCommand(Action<object?>, Func<object?, bool>?)

Inicializa una nueva instancia de la clase RelayCommand.

Declaration
public RelayCommand(Action<object?> action, Func<object?, bool>? canExecute)
Parameters
Type Name Description
Action<object> action

Comando a ejecutar.

Func<object, bool> canExecute

Función que determina si el comando puede ser ejecutado.

Methods

| Edit this page View Source

CanExecute(object?)

Define el método que determina si el comando puede ejecutarse en su estado actual.

Declaration
public bool CanExecute(object? parameter)
Parameters
Type Name Description
object parameter

Datos que usa el comando. Si el comando no exige pasar los datos, se puede establecer este objeto en null.

Returns
Type Description
bool

true si se puede ejecutar este comando; de lo contrario, false.

| Edit this page View Source

Execute(object?)

Define el método al que se llamará cuando se invoque el comando.

Declaration
public void Execute(object? parameter)
Parameters
Type Name Description
object parameter

Datos que usa el comando. Si el comando no exige pasar los datos, se puede establecer este objeto en null.

| Edit this page View Source

RaiseCanExecuteChanged()

Obliga al comando a evaluar CanExecute(object?).

Declaration
public static void RaiseCanExecuteChanged()

Events

| Edit this page View Source

CanExecuteChanged

Se produce cuando hay cambios que influyen en si el comando debería ejecutarse o no.

Declaration
public event EventHandler? CanExecuteChanged
Event Type
Type Description
EventHandler

Implements

ICommand

Extension Methods

Objects.ShallowCopyTo(object, object, Type)
ObjectExtensions.FieldsOf<T>(object)
ObjectExtensions.GetAttribute<T>(object)
ObjectExtensions.GetAttributes<T>(object)
ObjectExtensions.HasAttrValue<TAttribute, TValue>(object, out TValue)
ObjectExtensions.HasAttribute<T>(object)
ObjectExtensions.HasAttribute<T>(object, out T?)
ObjectExtensions.HasAttributes<T>(object, out IEnumerable<T>?)
ObjectExtensions.Is(object?, object?)
ObjectExtensions.IsEither(object, IEnumerable)
ObjectExtensions.IsEither(object, params object[])
ObjectExtensions.IsNeither(object, IEnumerable)
ObjectExtensions.IsNeither(object, params object[])
ObjectExtensions.IsNot(object?, object?)
ObjectExtensions.PropertiesOf<T>(object)
ObjectExtensions.WhichAre(object, IEnumerable<object>)
ObjectExtensions.WhichAre(object, params object[])
Common.IfNotNull<T>(T?, Action<T>)
Objects.Itself<T>(T)
Objects.ShallowCopyTo<T>(T, T)
CollectionExtensions.PushInto<TItem, TCollection>(TItem, ICollection<TCollection>)
DictionaryExtensions.PushInto<TKey, TValue>(TValue, TKey, IDictionary<TKey, TValue>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX