prism InvokeCommandAction behaviour ignoring IsEnabled property

Oct 16, 2014 at 4:16 PM
I am trying to get to the bottom of why the IsEnabled property of a checkbox is being ignored when using the prism InvokeCommandAction behaviour.

Essentially, if I use the standard InvokeCommandAction behaviour then everything works fine, but if I switch to the prism InvokeCommandAction, then the IsEnabled property is ignored.

To replicate this, I took the Commanding Quickstart from prism and changed the OrdersEditorView to this:
<StackPanel Orientation="Vertical">
    <ListView AutomationProperties.AutomationId="OrderListView" ItemsSource="{Binding Orders}" SelectionMode="Single" Width="Auto" Height="Auto" >
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="KeyUp">
                <prism:InvokeCommandAction Command="{Binding ProcessOrderCommand}" TriggerParameterPath="Key"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>
        <ListView.ItemTemplate>
            <DataTemplate DataType="{x:Type models:OrderViewModel}">
                <TextBlock Text="{Binding OrderName}" />
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
    <CheckBox IsEnabled="False" Content="Prism" >
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Checked">
                <prism:InvokeCommandAction Command="{Binding ProcessOrderCommand}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </CheckBox>
    <CheckBox IsEnabled="False" Content="Interactivity">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Checked">
                <i:InvokeCommandAction Command="{Binding ProcessOrderCommand}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </CheckBox>
</StackPanel>
So I've just wrapped the original ListView in a stack panel and added two checkboxes that bind the existing ProcessOrderCommand command to the InvokeCommandAction behaviour. The checkbox using the interactivity InvokeCommandAction is correctly disabled (the IsEnabled property is correctly set to False), but the checkbox using the prism InvokeCommandAction is enabled, even though the IsEnabled property is set to false.

Now this is just a simple example, in real life the behaviour is passing parameters to the command (which is why I want to use the prism version) and the IsEnabled property is bound to a property on a ViewModel. I've just reduced this example to its most basic elements. However this is such very specific strange behaviour, surely I'm doing something wrong here? This can't be a bug in prism can it?

(Note that this is in Prism5, but there is no topic option for PrismV5)