Example #1
0
        private void RenderOnCanvas(Measure measure)
        {
            if (Renderer == null)
            {
                Renderer = CreateRenderer(this);
            }
            foreach (var element in measure.Elements.Where(e => !(e is Barline)))
            {
                var frameworkElements = Renderer.OwnershipDictionary.Where(d => d.Value == element).Select(d => d.Key).ToList();
                foreach (var frameworkElement in frameworkElements)
                {
                    Renderer.Canvas.Children.Remove((View)frameworkElement);
                }
            }

            Renderer.Render(measure);
            if (SelectedElement != null)
            {
                ColorElement(SelectedElement, Color.Fuchsia);
            }
            InvalidateMeasure();
        }
Example #2
0
        private void RenderOnCanvas(Score score)
        {
            _innerScore = score;
            if (score == null)
            {
                return;
            }

            Children.Clear();
            Renderer = CreateRenderer(this);
            Renderer.Settings.RenderingMode = RenderingMode;
            Renderer.Settings.DefaultColor  = Renderer.ConvertColor(Color.Black);
            if (score.Staves.Count > 0)
            {
                Renderer.Settings.PageWidth = score.Staves[0].Elements.Count * 26;
            }
            Renderer.Render(score);
            if (SelectedElement != null)
            {
                ColorElement(SelectedElement, Color.Fuchsia);
            }
            //InvalidateMeasure();
        }