This project has moved and is read-only. For the latest updates, please go here.

I can't get RelayCommand to work

Nov 1, 2010 at 7:46 AM
Edited Nov 1, 2010 at 7:49 AM

Silverlight 4, the method doShowInvoice is never called.  What am I doing wrong?



public RelayCommand HandleShowInvoice { get; set;  }

HandleShowInvoice =

new RelayCommand(doShowInvoice, () => { return true; });


<Button x:Name="Showinvoice" Command="{Binding HandleShowInvoice}" Content="Show Invoice" Width="200" />

 I've also tried

 <Button x:Name="Showinvoice" Command="{Binding Path=HandleShowInvoice}" Content="Show Invoice" Width="200" />

Nov 2, 2010 at 12:11 PM

Your code is correct. Check that the DataContext of your Button is well your viewModel with the RelayCommand.