views:

581

answers:

2

Hi All,

I have noticed a strange behaviour when using the command functionality in Silverlight:

When the adding the commands:Click.Command and CommandParameter property, the IsEnabled property stops functioning:

<Button Content="Delete" 
    x:Name="Btn_Delete" 
    Margin="0,0,8,0" 
    MinWidth="75" 
    commands:Click.Command="{Binding DeleteCommand}" 
    commands:Click.CommandParameter="{Binding SelectedDepartment}" 
    IsEnabled="false" />

If I remove the commands: attributes the IsEnabled functions correctly. This behaviour is the same if IsEnabled is bound to a value on my view model too.

Is this a bug? Anyone know of any work arounds?

Thanks, Mark

A: 

I've implemented a workaround for now by adding a content control around the button:

<ContentControl IsEnabled="false">
<Button Content="Delete" 
    x:Name="Btn_Delete" 
    Margin="0,0,8,0" 
    MinWidth="75" 
    commands:Click.Command="{Binding DeleteCommand}" 
    commands:Click.CommandParameter="{Binding SelectedDepartment}" 
     />
</ContentControl>

Still interested to find any 'proper' solutions though.

Mark Cooper