Search code examples
c#wpfmusicxml

Why am I getting a namespace error with Manufaktura Library


I am attempting to use this library Manufaktura to draw music notation in a WPF application.

I have the using statement that I need according to the instructions on this page

using Manufaktura.Controls;
using Manufaktura.Model;
using Manufaktura.Music;
using Manufaktura.Controls.WPF;
using Manufaktura.Model.MVVM;

I have the appropriate dlls referenced in the solution explorer of Visual Studio as well.

When I used the code sample I am getting two errors (three but 2 are basically the same).

Code from Instruction:

public class TestDataViewModel : ViewModel
{
    private Score data;

    public Score Data
    {
        get { return data;  }
        set { data = value; OnPropertyChanged(() => Data); }
    }

    public void LoadTestData()
    {

    }
}

Errors:

Error 1 The type or namespace name 'Score' could not be found (are you missing a using directive or an assembly reference?)

And

Error 3 The type arguments for method 'Manufaktura.Model.MVVM.ViewModel.OnPropertyChanged(System.Linq.Expressions.Expression>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

Am I missing something?


Solution

  • I think you will need to reference the libraries instead of adding using statements. So, right-click your project's references and then "Add Reference..." for each class library listed in the documentation.

    FYI, the second error is just a consequence of the Score type not being found. Once the complier knows about Score, it should go away.

    Update: I inspected the Manufaktura.Controls class library and the Score class is in the namespace Manufaktura.Controls.Model. So try adding a using statement for that namespace too.