Generated by DocFX

Class RelayCommand<T>

A generic _command whose sole purpose is to relay its functionality to other objects by invoking delegates. The default return value for the CanExecute method is true. This class allows you to accept _command parameters in the Execute(T) and CanExecute(T) callback methods.

Inheritance
System.Object
RelayCommand<T>
Implements
IRelayCommand<T>
IRelayCommand
ICommand
Namespace: ISynergy.Framework.Mvvm.Commands
Assembly: ISynergy.Framework.Mvvm.dll
Syntax
public sealed class RelayCommand<T> : object, IRelayCommand<T>, IRelayCommand
Type Parameters
Name Description
T

The type of parameter being passed as input to the callbacks.

Constructors

View Source

RelayCommand(Action<T>)

Initializes a new instance of the RelayCommand<T> class that can always _execute.

Declaration
public RelayCommand(Action<T> execute)
Parameters
Type Name Description
Action<T> execute

The execution logic.

Remarks

Due to the fact that the interface exposes methods that accept a nullable parameter, it is recommended that if T is a reference type, you should always declare it as nullable, and to always perform checks within execute.

View Source

RelayCommand(Action<T>, Predicate<T>)

Initializes a new instance of the RelayCommand<T> class.

Declaration
public RelayCommand(Action<T> execute, Predicate<T> canExecute)
Parameters
Type Name Description
Action<T> execute

The execution logic.

Predicate<T> canExecute

The execution status logic.

Remarks

See notes in RelayCommand(Action<T>).

Methods

View Source

CanExecute(T)

Provides a strongly-typed variant of .

Declaration
public bool CanExecute(T parameter)
Parameters
Type Name Description
T parameter

The input parameter.

Returns
Type Description
System.Boolean

Whether or not the current command can be executed.

Remarks

Use this overload to avoid boxing, if T is a value type.

View Source

CanExecute(Nullable<Object>)

Declaration
public bool CanExecute(object? parameter)
Parameters
Type Name Description
System.Nullable<System.Object> parameter
Returns
Type Description
System.Boolean
View Source

Execute(T)

Provides a strongly-typed variant of .

Declaration
public void Execute(T parameter)
Parameters
Type Name Description
T parameter

The input parameter.

Remarks

Use this overload to avoid boxing, if T is a value type.

View Source

Execute(Nullable<Object>)

Declaration
public void Execute(object? parameter)
Parameters
Type Name Description
System.Nullable<System.Object> parameter
View Source

NotifyCanExecuteChanged()

Notifies that the property has changed.

Declaration
public void NotifyCanExecuteChanged()

Events

View Source

CanExecuteChanged

Declaration
public event EventHandler? CanExecuteChanged
Event Type
Type Description
System.Nullable<EventHandler>

Implements

IRelayCommand<T>
IRelayCommand
ICommand

Extension Methods

Matrix.Replace<T>(T, Object, Object)
Matrix.IsEqual(Object, Object, Decimal, Decimal)
EntityBaseExtensions.HasProperty(Object, String)
ArrayExtensions.Concatenate<T>(T, T[])
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>, Func<TSource, Boolean>)
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>)
ObjectExtensions.Clone<T>(T)
ObjectExtensions.To<T>(Object)
ObjectExtensions.To(Object, Type)
ObjectExtensions.HasMethod(Object, String)
ObjectExtensions.AddressOf<T>(T)
ReflectionExtensions.GetIdentityValue<T>(T)
ReflectionExtensions.GetIdentityValue<T, TResult>(T)
ReflectionExtensions.GetIdentityProperty<T>(T)
ReflectionExtensions.HasIdentityProperty<T>(T)
ReflectionExtensions.GetPropertyValue<T, TResult>(T, String, TResult)
ReflectionExtensions.GetPropertyInfo<T, TValue>(T, Expression<Func<T, TValue>>)
ReflectionExtensions.GetTitleValue<T>(T)
ReflectionExtensions.HasParentIdentityProperty<T>(T)
ReflectionExtensions.GetParentIdentityProperty<T>(T)
ReflectionExtensions.IsFreeApplication<T>(T)