Pre loader

Can WPF Run on Linux? It’s Possible, Here’s How

Categories

Can WPF Run on Linux? It’s Possible, Here’s How

Over the years the question has cropped up many times “Does WPF work on Linux?”

It’s no secret that C# code and .NET has been able to run on Linux (and macOS) for many years, but what about WPF? We’re revealing all in this article.

SciChart is a cross-platform chart library with implementations for WPF, JavaScript, as well as native iOS and Android now supports Avalonia XPF. This means our chart libraries run on Linux or embedded linux.

Our chart library is based on a proprietary C++ rendering engine codenamed Visual Xccelerator™. This provides the speed, performance that SciChart is well known for, but also a secondary benefit is the single shared codebase across platforms for drawing high-performance scientific, financial and medical charts and graphs with hardware acceleration in DirectX, OpenGL, Metal and WebGL.

As of yet, there is no pure C++ version of SciChart that could run in say, Qt applications, however, we have been making steps towards Linux support for SciChart via Avalonia XPF.

Read on to learn how…

Why SciChart on Linux?

WPF applications are typically Windows-based, as they require Microsoft .NET and the Windows Presentation Foundation to run. However, a subset of demanding scientific, financial or medical applications require charts that run on Linux. This could be for:

  • Embedded systems
  • Custom portable hardware
  • Electronic test equipment
  • Radio Frequency or Spectrum Analyzers
  • Oscilloscopes
  • Terminals or kiosks in factories, industrial processes or oil rigs
  • Maritime vessel instrumentation
  • Aircraft instrumentation

By running Linux on an embedded system, the cost basis goes down significantly for manufacturers of embedded devices who won’t have to pay for a Windows license.

The RTOS (real-time operating system) nature of Linux makes it perfect for high-performance, critical embedded systems which require big-data or real-time charts.

Can WPF Run on Linux?

Yes, technically, WPF can run on Linux – if you know how.

Microsoft introduced .NET Core in 2014, later superseded by .NET, which aimed to be a cross-platform implementation of the .NET Framework. According to Microsoft official sources, WPF is only for Windows, as this part of the framework was not ported over to Linux.

However, the geniuses at Avalonia have managed to make a completely cross-platform framework called Avalonia XPF. This version of the Windows Presentation Foundation runs using OpenGL instead of DirectX. Quite an astonishing achievement.

What is Avalonia XPF?

Avalonia XPF is a proprietary, cross-platform implementation of WPF brought to you by the developers of Avalonia UI.

This framework enables full WPF compatibility of legacy and existing applications but allows them to run on Windows, Linux and macOS. It achieves this by substituting the DirectX and MilCore Windows specific functions and routines in WPF for equivalents in OpenGL and C++.

This means that your existing WPF applications can be ported to run on Linux, often without any code change and in minutes.

It can’t be stressed enough what an enormous timesaver this is for teams who have large WPF applications that want to target multiple platforms.

Introducing SciChart for Avalonia XPF

SciChart worked with the Avalonia team to provide an Avalonia XPF compatible version of SciChart WPF that runs on Linux.

Here’s how we did it:

  • Our C++ Visual Xccelerator™ engine was retargeted to Linux and compiled using CMake.
  • We swapped out all the DirectX rendering in SciChart for dynamic choosing of DirectX or OpenGL, depending on platform.
  • We built a side-by-side solution for SciChart WPF that runs targeting Avalonia XPF, as well as the existing .NET Framework, .NET 6,7,8 etc.
  • The examples app and demos were all tested in the new environment.

It’s important to state we had to make almost no code changes to SciChart WPF itself, and only minimal changes to the SciChart API. This is a fully 100% compatible version of SciChart that seamlessly works on Linux when targeting Avalonia XPF.

SciChart on Linux with Avalonia XPF

Video of SciChart WPF charts running on Linux using Avalonia XPF.

We’re using Visual Studio Code to compile the demo application, and run a number of examples inside an Ubuntu VM.

This is the exact same code and API as SciChart WPF for Windows. This means your Windows applications can run on Linux when targeting Avalonia XPF.

The first demo is the Spectrogram demo, showing the performance capabilities of SciChart for real-time charts on Linux, followed by the ECG Monitor demo, a real-time medical vital signs monitor.

We then showcase the Digital Analyzer Performance demo – a big data demo which loads multiple channels of digital data each with billions (or even tens of billions) of data-points. It’s useful for creating Logic Analyzer hardware.

Having successfully released an Avalonia XPF compatible version of SciChart back in early 2025, both 2D and 3D examples have been enabled.

Below are some screenshots of SciChart WPF charts running on Linux using Avalonia XPF.

SciCharts vertically stacked YAxis ECG chart shown on the linux software Vertically Stacked Axis ECG Charts on Linux
SciCharts watetfall chart demo shown on linux software 2D Waterfall Chart demo on Linux
SciCharts parallel coordinate plot graph on Linux Parallel Coordinate Plot on Linux
Stacked SciChart columns and bar charts on linux software Stacked Column and Bar Charts on Linux

From Beta Version to 100% Roll Out

Since 2025, we’ve moved from a BETA version to a fully rolled out and supported charting solution. Developers can access 100% compatible code and API to SciChart WPF. Our demo example applications run on both Windows and Linux under the Avalonia XPF framework.

Try Avalonia XPF With SciChart

By Andrew Burnett-Thompson | Jun 30, 2024
CEO / Founder of SciChart. Masters (MEng) and PhD in Electronics & Signal Processing.Follow me on LinkedIn for more SciChart content, or twitter at @drandrewbt.
5 comments
  1. Update: the Avalonia XPF examples can now be cloned from https://github.com/ABTSoftware/SciChart.Avalonia.XPF.Examples, at the moment this references our nightly build feed from Myget. You’ll have to add a reference to the nightly build feed following instructions from here : https://www.scichart.com/documentation/win/current/Getting_Nightly_Builds_with_NuGet.html. We’re in the process of publishing this to NuGet and should have it available there soon!

  2. Any updates on the status of this project? My company has a WPF application that uses SciChart and we are starting to port the application to Avalonia.

Leave a Reply