With the EventToCommand class, the command is not invoked when the associated element is disabled. Most of the time, it is a correct behaviour but sometimes, we would like to still invoke the command.
I suggest to add a property on the EventToCommand class like this :
/// <summary>
/// Specifies whether the Command must be always invoked or only when the
/// associated element is enabled
/// </summary>
public bool AlwaysInvokeCommand
{
get { return (bool)GetValue(AlwaysInvokeCommandProperty); }
set { SetValue(AlwaysInvokeCommandProperty, value); }
}
/// <summary>
/// Executes the trigger.
/// </summary>
protected override void Invoke(object parameter)
{
if (AssociatedObject == null || !AlwaysInvokeCommand && AssociatedElementIsDisabled())
{
return;
}
...
}
Comments: Fix is in Codeplex. Will release to Nuget in V5.2 on which I am currently working.
I suggest to add a property on the EventToCommand class like this :
/// <summary>
/// Specifies whether the Command must be always invoked or only when the
/// associated element is enabled
/// </summary>
public bool AlwaysInvokeCommand
{
get { return (bool)GetValue(AlwaysInvokeCommandProperty); }
set { SetValue(AlwaysInvokeCommandProperty, value); }
}
/// <summary>
/// Executes the trigger.
/// </summary>
protected override void Invoke(object parameter)
{
if (AssociatedObject == null || !AlwaysInvokeCommand && AssociatedElementIsDisabled())
{
return;
}
...
}
Comments: Fix is in Codeplex. Will release to Nuget in V5.2 on which I am currently working.