1

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?

Artem Kulikov
  • 2,250
  • 19
  • 32
xerotolerant
  • 1,955
  • 4
  • 21
  • 39

1 Answers1

2

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.

spoida
  • 2,655
  • 1
  • 23
  • 14
  • Thanks! This worked. I did in fact add the references in the solution explorer already. I am new to this and figured I would inspect it. In ActionScript 3 you can add namespaces and all subsidiaries with the syntax: Example.com.*; is there an equivalent facility in C#? – xerotolerant Aug 17 '15 at 13:01
  • C# doesn't have such a feature unfortunately. Here's a good [SO thread on C# namespace using statements](http://stackoverflow.com/questions/9023465/importing-nested-namespaces-automatically-in-c-sharp). One thing you might not be aware of is that Visual Studio can automatically add any missing using statements for you. In VS2015 you can right-click on the Score class and select "Quick Actions...". The first available action is to add "using Manufaktura.Controls.Model;" to fix the error. This will only work if you have already referenced the assembly though. – spoida Aug 18 '15 at 03:14