Skip to main content

Configuration (.NET)

The .NET setup differs by host: console apps use the low-level classes directly, while WPF and WinForms controls wrap those classes behind a UI-friendly API. This page walks through each of the four surfaces โ€” setup, settings, events, and API โ€” on all three hosts.

Setupโ€‹

Consoleโ€‹

Non-UI code uses the low-level classes directly โ€” ScoreLoader, ScoreRenderer, Settings, and the model classes under AlphaTab.Model. The installation page shows the full render pipeline. To see how the UI controls are built on top of the same classes, browse the C# sources on GitHub.

WPFโ€‹

The WPF AlphaTab control exposes the same functionality as the web AlphaTabApi, wrapped in a WPF-idiomatic component. Drop it into any XAML and bind its properties:

<wpf:AlphaTab xmlns:wpf="clr-namespace:AlphaTab.Wpf;assembly=AlphaTab.Windows"
Tracks="{Binding TracksToDisplay}" />

WinFormsโ€‹

The WinForms AlphaTabControl mirrors the WPF control's API. Add it to the form via the designer or in code:

using AlphaTab.WinForms;

var control = new AlphaTabControl
{
Dock = System.Windows.Forms.DockStyle.Fill
};
Controls.Add(control);

Settingsโ€‹

The Settings class configures every aspect of alphaTab โ€” rendering engine, layout mode, playback options, imported file. Console code creates a Settings instance directly and passes it to the renderer:

using AlphaTab;

var settings = new Settings();
settings.Core.Engine = "skia";
settings.Display.LayoutMode = LayoutMode.Page;

The WPF and WinForms controls expose a Settings property. Mutating that object does not trigger a re-render automatically โ€” call Api.UpdateSettings() to apply the changes:

control.Settings.Display.LayoutMode = LayoutMode.Horizontal;
control.Api.UpdateSettings();

Both controls also expose a Tracks property. Assign it to change which tracks are rendered.

The Settings reference documents every option.

Eventsโ€‹

alphaTab uses its own event pattern for consistency with the JavaScript version โ€” not C# events. Subscribe with .On(handler) and unsubscribe with .Off(handler). Console code hooks events on the ScoreRenderer; UI controls expose the same events through their Api property:

control.Api.PlayedBeatChanged.On(beat =>
{
UpdateFretboard(beat);
});

The API reference lists every event alphaTab exposes.

APIโ€‹

The high-level API is available on UI controls through the Api property. Use it to load scores, drive playback, and query state:

control.Api.Tex("\\title \"Hello alphaTab\" . 3.3*4");
control.Api.PlayPause();

Console code operates one layer below the API โ€” directly on ScoreLoader, ScoreRenderer, and the model classes. See the full API reference for both surfaces.