
A barcode stores product or company information in a machine‑readable visual form. Barcodes are widely used for shipment tracking and inventory management. You can easily generate many barcode types in WPF applications. In this article we will show how to generate and display a barcode image in a WPF application. After the steps, you will have a functional WPF Barcode Generator in C#. Let’s begin.
The article covers these topics:
- Features of WPF Barcode Generator
- C# Barcode Generator API
- Steps to Create WPF Barcode Generator
- Generate Barcode with Additional Options
- Demo WPF Barcode Generator
- Download Source Code
Features of WPF Barcode Generator
Our WPF barcode generator includes:
- Support for these barcode symbologies:
- Code128
- Code11
- Code39
- QR
- Datamatrix
- EAN13
- EAN8
- ITF14
- PDF417
- Ability to save the generated image as:
- Preview of the generated barcode image.
C# Barcode Generator API
We use the Aspose.BarCode for .NET API to create barcode images and preview them in the WPF app. This feature‑rich API lets you generate, scan, and read a wide range of barcode types. It also lets you customize background color, bar color, rotation angle, x‑dimension, image quality, resolution, captions, size, and more.
Steps to Create WPF Barcode Generator
Follow these steps to generate and display a barcode in a WPF app:
- First, create a new project and select the WPF Application template.

Select the project template.
Enter a project name, for example BarcodeGen.
Choose the .NET framework and click Create.
Open NuGet Package Manager and install the Aspose.BarCode for .NET package.

Install Aspose.BarCode for .NET
- Add a new class Barcode.cs to define the barcode.
- Open MainWindow.xaml and add the required controls as shown:

Add the required controls
You can also replace the entire MainWindow.xaml content with the script below.
- Open MainWindow.xaml.cs and add the btnGenerate_Click event to handle the Generate Barcode button click.
- Add a function that creates a barcode.
- Finally, run the application.
Generate Barcode with Additional Options
You can also generate barcodes with type‑specific options. The WPF generator includes a checkbox that triggers a function to apply additional settings for different barcode types.
Read more about Generation Specifics for Barcode Types in the documentation.
Demo WPF Barcode Generator
Below is a demonstration of the WPF Barcode Generator we built.

Demo WPF Barcode Generator
Download Source Code
Download the full source code from GitHub.
Get a Free License
Obtain a free temporary license to try the library without evaluation limits.
Conclusion
In this article we showed how to generate multiple barcode types in a WPF application and how to preview the barcode image programmatically. Explore more about Aspose.BarCode for .NET using the documentation. For questions, visit our forum.