TriggerAction driven command execution with zero code behind


The new Behavior-based trigger system (which works in Silverlight and WPF) opens the door for custom Trigger Actions. Now that we have custom Trigger Actions, we will be able to create an ExecuteCommandAction that allows you to invoke a Command from any trigger.

What’ll we be doing is creating an ExecuteCommandAction that we can trigger using any Blend trigger, this action will be bound to a ICommand exposed by the ViewModel.

In the current version of Silverlight standard behaviors don’t support Binding, there is a work around discussed earlier on this blog by PeteBlois using BindingListeners and exposing Bindings rather than ICommand.

public class ExecuteCommandAction : TriggerAction<FrameworkElement>


private readonly BindingListener commandListener;

private readonly BindingListener commandParameterListener;


And here –>


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s