WPF and WinForms controls
Embedding alphaTab in a .NET desktop app is a NuGet install and a control declaration. AlphaTab.Windows ships two ready-made hosts: a WPF control for XAML apps and a Control subclass for classic WinForms. Both wrap the same core rendering and playback engine as the web and Android builds.
Rendered here on the Web backend. On .NET, both the WPF AlphaTab control and the WinForms AlphaTabControl produce this output through the same engine โ see the XAML and C# below.
Install the packageโ
AlphaTab.Windows targets .NET 8.0 and depends on the base AlphaTab package. Add it through the .NET CLI or your .csproj:
dotnet add package AlphaTab.Windows
WPFโ
Declare the control in XAML alongside the alphaTab namespace, then bind Tracks to the collection you want to render:
<Window x:Class="AlphaTab.Samples.Wpf.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpf="clr-namespace:AlphaTab.Wpf;assembly=AlphaTab.Windows"
Title="alphaTab" Height="800" Width="1000">
<wpf:AlphaTab x:Name="AlphaTab" Tracks="{Binding TracksToDisplay}" />
</Window>
Load a score in the view model or code-behind and expose the tracks the control renders:
using AlphaTab.Importer;
using AlphaTab.Model;
var score = ScoreLoader.LoadScoreFromBytes(File.ReadAllBytes("song.gp"));
TracksToDisplay = new[] { score.Tracks[0] };
public IEnumerable<Track> TracksToDisplay { get; }
WinFormsโ
Instantiate AlphaTabControl, dock it, and assign tracks the same way as WPF:
using AlphaTab.Importer;
using AlphaTab.WinForms;
var score = ScoreLoader.LoadScoreFromBytes(File.ReadAllBytes("song.gp"));
var control = new AlphaTabControl
{
Dock = DockStyle.Fill,
Tracks = new[] { score.Tracks[0] },
};
Controls.Add(control);
The WinForms control shares the WPF playback pipeline but cannot render semi-transparent cursors, since WinForms lacks a proper alpha channel. Display and audio are otherwise identical.
Where to look nextโ
- Installation (.NET) โ package layout, console rendering, and dependency notes.
- Custom fonts on Skia โ how to register titles, lyrics, and fingering fonts on the Skia backend both controls use.
- AlphaTabView on Android โ the sibling native host on Android.
- Custom UI facade โ for hosts .NET does not ship a control for, such as Avalonia or MAUI.
- alphaTabSamplesDotNet โ worked WPF and WinForms sample projects.