Frets
Frets

Reputation: 147

Binding RibbonButton

I'm playing with my first wpf project using the mvvm pattern. I have Microsoft Ribbon for WPF, that i can't get to fire my method in the MainWindowViewModel. I'm trying to follow as described here: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

MainWindow.xaml

<ribbon:RibbonButton x:Name="Button1" LargeImageSource="Images\home32.png" Label="Opret klub" Command="{Binding Path=CreateNewClub1}" />

MainWindowViewModel

public RelayCommand CreateNewClub1()
    {
        return new RelayCommand(param => this.CreateNewClub());
    }

I can't get it to fire the method CreateNewClub1(). What am i missing?

Upvotes: 0

Views: 884

Answers (1)

Clemens
Clemens

Reputation: 128147

CreateNewClub1 must be a property, not a method:

public RelayCommand CreateNewClub1
{
    get
    { 
        return new RelayCommand(param => this.CreateNewClub()); 
    }
} 

Upvotes: 1

Related Questions