Table of Contents

Class CommandExtensions

Namespace
Dmnk.Blazor.Mvvm
Assembly
Dmnk.Blazor.Mvvm.dll
public static class CommandExtensions
Inheritance
CommandExtensions
Inherited Members

Methods

Bind<T>(ICommand, AbstractMvvmComponentBase<T>)

Convert a parameterless ICommand to a parameterless Action. The returned Action will check if the command can be executed before executing it.

Blazor components will typically not accept commands but lambdas. This method allows for a slightly nicer syntax, but more importantly, it avoids allocating new Action instances on every render.

public static Action Bind<T>(this ICommand cmd, AbstractMvvmComponentBase<T> component) where T : INotifyPropertyChanged

Parameters

cmd ICommand
component AbstractMvvmComponentBase<T>

Returns

Action

Type Parameters

T