Click here to Skip to main content
Click here to Skip to main content

PSAM WPF Control Library

, 24 Jun 2010 BSD
Rate this:
Please Sign up or sign in to vote.
PSAM Control Library ported over to WPF


PSAM WPF Control Library is a WPF version of PSAM Control Library containing the IncipitViewer control for drawing musical notes which can be read from MusicXml file or added programmatically. PSAM WPF Control Library requires PSAM Control Library to run because it uses some of PSAM Control Library's classes. PSAM WPF Control Library is written in C# and XAML under Microsoft Visual Studio Express.

Using the Code

IncipitViewerWPF control requires special font to draw notes and other musical symbols. You can create your own font or use the included font Polihymnia which is based on Ben Laenen's Euterpe font and distributed under Sil Open Font Licence. Of course, you have to install the font in your fonts directory to display notes properly.

You can load a MusicXml file or add notes programmatically the same way as it is done in PSAM Control Library. Read the article about PSAM Control Library for details.

The control looks like that:


Because it's a WPF control, you can apply fancy effects like these:



Printing is even simpler than in PSAM Control Library. You just have to write the following code:

PrintDialog dialog = new PrintDialog();
if (dialog.ShowDialog() == true)
     dialog.PrintVisual(viewer, "Test");

where viewer is a IncipitViewerWPF control. Sample printout:


Points of Interest

Porting PSAM Control Library to WPF was quite simple. I made some changes to PSAM Control Library, namely I added a new interface IIncipitViewer which represents IncipitViewer's methods and properties and then I implemented this interface in IncipitViewerWPF class. I also moved ParseXml method from IncipitViewer to a new class called XmlParser so I didn't have to rewrite this method in IncipitViewerWPF class. To draw notes and musical symbols, I use an overridden OnRender method and a DrawingContext object.


This article, along with any associated source code and files, is licensed under The BSD License


About the Author


Poland Poland
I graduated from Adam Mickiewicz University in Poznań where I completed a MA degree in computer science (MA thesis: Analysis of Sound of Viola da Gamba and Human Voice and an Attempt of Comparison of Their Timbres Using Various Techniques of Digital Signal Analysis) and a bachelor degree in musicology (BA thesis: Continuity and Transitions in European Music Theory Illustrated by the Example of 3rd part of Zarlino's Institutioni Harmoniche and Bernhard's Tractatus Compositionis Augmentatus). I also graduated from a solo singing class in Fryderyk Chopin Musical School in Poznań. I'm a self-taught composer and a member of informal international group Vox Saeculorum, gathering composers, which common goal is to revive the old (mainly baroque) styles and composing traditions in contemporary written music. I'm the annual participant of International Summer School of Early Music in Lidzbark Warmiński.

Comments and Discussions

SuggestionRefactoring & Silverlight porting PinmemberKvanttt26-Jun-11 23:09 
GeneralRe: Refactoring & Silverlight porting PinmemberAjcek8426-Jun-11 23:24 
GeneralRe: Refactoring & Silverlight porting PinmemberKvanttt26-Jun-11 23:45 
GeneralRe: Refactoring & Silverlight porting PinmemberAjcek8424-Jul-11 3:54 
GeneralRe: Refactoring & Silverlight porting Pinmembermcraig1555-Aug-11 5:28 
NewsRe: Refactoring & Silverlight porting PinmemberKvanttt14-Aug-11 3:01 
GeneralRe: Refactoring & Silverlight porting Pinmembermcraig1553-Oct-11 6:20 
GeneralRe: Refactoring & Silverlight porting PinmemberAjcek8417-May-14 2:43 
GeneralRe: Refactoring & Silverlight porting PinmemberAjcek844-Jan-15 23:41 
GeneralVery good work! Question about multiple staves Pinmembermcraig15520-May-11 8:48 
GeneralRe: Very good work! Question about multiple staves PinmemberAjcek8421-May-11 1:17 
GeneralRe: Very good work! Question about multiple staves Pinmembermcraig15521-May-11 2:41 
GeneralRe: Very good work! Question about multiple staves PinmemberTipochek2-Dec-13 16:23 
GeneralExcellent! Vote of 5, and two questions: PinmemberGuenter Prossliner29-Mar-11 4:22 
GeneralRe: Excellent! Vote of 5, and two questions: PinmemberAjcek8429-Mar-11 5:06 
GeneralRe: Excellent! Vote of 5, and two questions: PinmemberGuenter Prossliner30-Mar-11 1:06 
GeneralRe: Excellent! Vote of 5, and two questions: PinmemberAjcek8431-Mar-11 1:13 
GeneralRe: Excellent! Vote of 5, and two questions: PinmemberGuenter Prossliner31-Mar-11 23:45 
GeneralRe: Excellent! Vote of 5, and two questions: PinmemberAjcek841-Apr-11 1:53 
GeneralRe: Excellent! Vote of 5, and two questions: Pinmemberdavidorn25-Jul-11 20:10 
GeneralMy vote of 5 PinmemberKenJohnson9-Jul-10 21:48 
GeneralNice! PinmemberJammer4-Jul-10 23:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150305.1 | Last Updated 25 Jun 2010
Article Copyright 2010 by Ajcek84
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid