Search code examples
c#wpfvisual-studio.net-assemblycaliburn.micro

The name 'NotifyOfPropertyChange' does not exist in the current context


I'm getting an error on the following piece of code:

public class PathSelectionPageViewModel : ObservableObject, INavigable, INotifyPropertyChanged
{
    private DriveInfo driveSelection;
    public DriveInfo DriveSelection_SelectionChanged
    {
        get
        {
            return driveSelection;
        }
        set
        {

            if (value == driveSelection) return;
            driveSelection = value;
            NotifyOfPropertyChange(() => DriveSelection_SelectionChanged);//must be implemented
        }

    }
}

I'm getting the error NotifyOfPropertyChange Does not exists in current context. All usings are ok; I checked similiar questions and found no answer. Any suggestion onwhy it can not find the NotifyOfPropertyChange?


Solution

  • In the Visual Studio "Solution Explorer" (usually in the right pane), go to the Project where you are using this method and raise the context menu for "Add Reference".

    When the dialog appears, navigate to your Caliburn assemblies and select the DLL's.

    Then return to your project where the compiler error is happening and add the appropriate 'using' statement so that the compiler can find it.