I have a problem with 'NoteViewer' in XML。

寛明 水崎 1 Reputation point
2020-04-18T05:36:28.407+00:00

Dear sir,

I managed to create a sample mentioned here with WPF App and Blank App (Universal Windows)
http://musicengravingcontrols.com/en-US/Articles/Display?id=2
7486-批注-2020-04-17-110308.png
However, I have a problem here.
Error Lists say "Unknown type 'NoteViewer' in XML in XML namespace~.
Strangely enough, when I made this sample with WPF App, I can get a music score despite having the same error. But in the case of Universal Windows, I can not get anu music sore here like below.
This proble may have something to do with 'NoteViewer' but no matter what I do,
I failed solve this problem by myself.

Could you help me on this regard? It seems that this proble is above my head.

Kind Regards,

Hiroaki Mizusaki

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,678 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Michel Davis 1 Reputation point
    2020-04-19T15:06:26.263+00:00

    ckeck your referenced dll in <xmlns:ManufactorControls= … Please, show all declarations in Page node.complete-blog-marketing-guide-blogger.html

    0 comments No comments

  2. 寛明 水崎 1 Reputation point
    2020-04-21T05:44:23.487+00:00

    Hello,

    Here is what I wrote.

    <Page
    x:Class="App6.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ManufakturaControls="clr-namespace:Manufaktura.Controls.UniversalApps;assembly=Manufaktura.Controls.UniversalApps"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    
    <Grid>
        <StackPanel>
            <ManufakturaControls:NoteViewer x:Name="noteViewer1" ScoreSource="{Binding Data}" Height="110"/>
        </StackPanel>
    </Grid>
    

    </Page>


  3. 寛明 水崎 1 Reputation point
    2020-04-20T06:11:45.45+00:00

    Hello,

    First, I downloaded Manufaktura.Music.dll, Manufaktura.Controls.dll, Manufaktura.Model.dll and Manufaktura.UniversalApps.dll from here -https://bitbucket.org/Ajcek/manufakturalibraries/src/master/ and installed those four.

    Next, what I wrote is the below.

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Runtime.InteropServices.WindowsRuntime;
    using Windows.Foundation;
    using Windows.Foundation.Collections;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using Windows.UI.Xaml.Controls.Primitives;
    using Windows.UI.Xaml.Data;
    using Windows.UI.Xaml.Input;
    using Windows.UI.Xaml.Media;
    using Windows.UI.Xaml.Navigation;

    using Windows.UI.Xaml.Resources;

    using Manufaktura.Music;
    using Manufaktura.Model;
    using Manufaktura.Controls;
    using Manufaktura.Controls.UniversalApps;
    using Manufaktura.Controls.Model;

    using Manufaktura.Music.Model;
    using Manufaktura.Music.Model.Harmony;
    using Manufaktura.Music.Model.MajorAndMinor;

    namespace App6
    {

    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            var viewModel = new TestDataViewModel();
            DataContext = viewModel;
            viewModel.LoadTestData();
        }
        public class TestDataViewModel : ViewModel
        {
            private Score data;
            public Score Data
            {
                get { return data; }
                set { data = value; OnPropertyChanged(() => Data); }
            }
            public void LoadTestData()
            {
                var score = Score.CreateOneStaffScore(Clef.Treble, new MajorScale(Step.C, false));
                score.FirstStaff.Elements.Add(new Note(Pitch.C5, RhythmicDuration.Quarter));
                score.FirstStaff.Elements.Add(new Note(Pitch.B4, RhythmicDuration.Quarter));
                score.FirstStaff.Elements.Add(new Note(Pitch.C5, RhythmicDuration.Half));
                score.FirstStaff.Elements.Add(new Barline()); Data = score;
    
    
                  var secondStaff = new Staff();
                  secondStaff.Elements.Add(Clef.Treble);
                  secondStaff.Elements.Add(new Key(0));
                  secondStaff.Elements.Add(new Note(Pitch.G4, RhythmicDuration.Whole));
                  secondStaff.Elements.Add(new Barline());
                  score.Staves.Add(secondStaff);
    
                  score.Staves.Add(new Staff());
                  score.ThirdStaff.Elements.Add(Clef.Tenor);
                  score.ThirdStaff.Elements.Add(new Key(0));
                  score.ThirdStaff.Elements.Add(new Note(Pitch.D4, RhythmicDuration.Half));
                  score.ThirdStaff.Elements.Add(new Note(Pitch.E4, RhythmicDuration.Half));
                  score.ThirdStaff.Elements.Add(new Barline());
    
                  score.Staves.Add(new Staff());
                  score.Staves[3].Elements.Add(Clef.Bass);    //0-based index
                  score.Staves[3].Elements.Add(new Key(0));
                  score.Staves[3].Elements.Add(new Note(Pitch.G3, RhythmicDuration.Half));
                  score.Staves[3].Elements.Add(new Note(Pitch.C3, RhythmicDuration.Half));
                  score.Staves[3].Elements.Add(new Barline());  
    
                //  var parser = new MusicXmlParser();
                //  score = parser.Parse(XDocument.Load(@"D:\Dokumenty\Manufaktura programów\Dane do bazy\2014-08-01 DWOK tom 1 numery 1 i 5\DWOK tom 1, s. 3, nr 1 a.xml"));
                //   Data = score;
            }
        }
    }
    

    }

    And the error I got is "
    Error Unknown type 'NoteViewer' in XML namespace 'clr-namespace:Manufaktura.Controls.UniversalApps;assembly=Manufaktura.Controls.UniversalApps' "

    That is everything I can show.

    Kind Regard,

    Hiroaki