Skip to main content
Version: 4.1

ICommandSourceExtensions

Namespace: Wisej.Web.Markup

Assembly: Wisej.Framework (4.1.0.0)

Adds fluent markup extension methods to the ICommandSource interface.

public class ICommandSourceExtensions

Methods

Static member Command<TCommandSource>(button, value)

Sets the Command property of the specified ICommandSource.

ParameterTypeDescription
TCommandSourceThe type of the command source, must implement ICommandSource.
buttonTCommandSourceThe command source for which to set the Command property.
valueICommandThe ICommand to associate with the command source.

Returns: TCommandSource. The modified command source with the updated Command property.

This method allows you to associate a command with the command source, enabling command-based interactions.


myCommandSource.Command(new RelayCommand());

Static member OnCommandChanged<TCommandSource>(button, action)

Attaches an event handler for the CommandChanged event of the specified ICommandSource.

ParameterTypeDescription
TCommandSourceThe type of the command source, must implement ICommandSource.
buttonTCommandSourceThe command source to attach the event handler to.
actionAction<TCommandSource>An action to execute when the command changes.

Returns: TCommandSource. The modified command source with the attached CommandChanged event handler.

This method allows you to execute a custom action whenever the command associated with the command source changes.


myCommandSource.OnCommandChanged(cs =>
{
AlertBox.Show("Command changed!");
});