views:

33

answers:

1

Hi i have a button which has a Command property . However , i want that button to be disable (user can't click on it) until another button has been clicked. For example, user can only click on the Save button after the New button has been clicked

So i do the following

<telerik:RadButton Content="Save" Height="22" HorizontalAlignment="Right" Margin="0,0,72,25" Name="saveRBtn" VerticalAlignment="Bottom" Width="43" Grid.Column="5" Grid.Row="4" 
                       IsEnabled="False"
                       Command="{Binding Path=LoadCommand, ElementName=documentLineDomainDataSource}" 
                       Click="saveRBtn_Click"/>

However, it seems like that the button won't be disabled with the setting IsEnabled = False if i have the Command property when i take the command property out the code then the Setting IsEnabled = false works fine

not sure why the IsEnabled setting won't work if the Command property presents.

plz help me

thank you

+2  A: 

A button can work with or without a Command. You use the Click event and the IsEnabled property if you don't use the Command. They have priority over the Command as they are more "direct" (and were in Silverlight before it supported the Command property).

Normally, if you use a Command, you don't set IsEnabled and don't handle the Click event. The button will be enabled if the command can be executed (CanExecute property) and it will call the Execute method of the button.

To answer your question, you should remove the setting of IsEnabled and the click handler and do everything through the Command object.

Timores