![]() |
VOOZH | about |
dotnet add package ZXing.Net.Maui.Controls --version 0.7.3
NuGet\Install-Package ZXing.Net.Maui.Controls -Version 0.7.3
<PackageReference Include="ZXing.Net.Maui.Controls" Version="0.7.3" />
<PackageVersion Include="ZXing.Net.Maui.Controls" Version="0.7.3" />Directory.Packages.props
<PackageReference Include="ZXing.Net.Maui.Controls" />Project file
paket add ZXing.Net.Maui.Controls --version 0.7.3
#r "nuget: ZXing.Net.Maui.Controls, 0.7.3"
#:package ZXing.Net.Maui.Controls@0.7.3
#addin nuget:?package=ZXing.Net.Maui.Controls&version=0.7.3Install as a Cake Addin
#tool nuget:?package=ZXing.Net.Maui.Controls&version=0.7.3Install as a Cake Tool
The successor to ZXing.Net.Mobile: barcode scanning and generation for .NET MAUI applications
<img src="https://user-images.githubusercontent.com/271950/129272315-b3f5a468-c585-49f2-bbab-68a884618b94.png" width="300" />
Install ZXing.Net.Maui.Controls NuGet package on your .NET MAUI application
Make sure to initialize the plugin first in your MauiProgram.cs, see below
// Add the using to the top
using ZXing.Net.Maui.Controls;
// ... other code
public static MauiApp Create()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseBarcodeReader(); // Make sure to add this line
return builder.Build();
}
Now we just need to add the right permissions to our app metadata. Find below how to do that for each platform.
Before using barcode scanning, you can check if the device supports it (i.e., has a camera available):
if (ZXing.Net.Maui.BarcodeScanning.IsSupported)
{
// Device has a camera, safe to use barcode scanning
}
else
{
// No camera available, show alternative UI or message
}
This is useful for handling devices without cameras gracefully, avoiding runtime exceptions.
For Android go to your AndroidManifest.xml file (under the Platforms\Android folder) and add the following permissions inside of the manifest node:
<uses-permission android:name="android.permission.CAMERA" />
For iOS go to your info.plist file (under the Platforms\iOS folder) and add the following permissions inside of the dict node:
<key>NSCameraUsageDescription</key>
<string>This app uses barcode scanning to...</string>
Make sure that you enter a clear and valid reason for your app to access the camera. This description will be shown to the user.
Windows is not supported at this time for barcode scanning. You can however use the barcode generation. No extra permissions are required for that.
For more information on permissions, see the Microsoft Docs.
If you're using the controls from XAML, make sure to add the right XML namespace in the root of your file, e.g: xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI.Controls"
<zxing:CameraBarcodeReaderView
x:Name="cameraBarcodeReaderView"
BarcodesDetected="BarcodesDetected" />
Configure Reader options
cameraBarcodeReaderView.Options = new BarcodeReaderOptions
{
Formats = BarcodeFormats.OneDimensional,
AutoRotate = true,
Multiple = true
};
QR codes with international characters (e.g., £, €, ¥, or non-Latin scripts) are supported by default with UTF-8 encoding. You can override this if needed:
cameraBarcodeReaderView.Options = new BarcodeReaderOptions
{
Formats = BarcodeFormats.TwoDimensional,
CharacterSet = "ISO-8859-1" // Override default UTF-8 if needed
};
Toggle Torch
cameraBarcodeReaderView.IsTorchOn = !cameraBarcodeReaderView.IsTorchOn;
Flip between Rear/Front cameras
cameraBarcodeReaderView.CameraLocation
= cameraBarcodeReaderView.CameraLocation == CameraLocation.Rear ? CameraLocation.Front : CameraLocation.Rear;
Select a specific camera
// Get available cameras
var cameras = await cameraBarcodeReaderView.GetAvailableCameras();
// Select a specific camera by setting the SelectedCamera property
if (cameras.Count > 0)
{
cameraBarcodeReaderView.SelectedCamera = cameras[0];
}
// Or loop through available cameras and select one by name
foreach (var camera in cameras)
{
Console.WriteLine($"Camera: {camera.Name} ({camera.Location})");
// Select the first rear camera found
if (camera.Location == CameraLocation.Rear)
{
cameraBarcodeReaderView.SelectedCamera = camera;
break;
}
}
Handle detected barcode(s)
protected void BarcodesDetected(object sender, BarcodeDetectionEventArgs e)
{
foreach (var barcode in e.Results)
Console.WriteLine($"Barcodes: {barcode.Format} -> {barcode.Value}");
}
<zxing:BarcodeGeneratorView
HeightRequest="100"
WidthRequest="100"
ForegroundColor="DarkBlue"
Value="https://dotnet.microsoft.com"
Format="QrCode"
Margin="3" />
The BarcodeGeneratorView supports UTF-8 character encoding by default, which allows you to encode international characters including Chinese, Japanese, Arabic, and other non-ASCII characters. You can also specify a different character encoding if needed:
<zxing:BarcodeGeneratorView
HeightRequest="100"
WidthRequest="100"
Value="测试中文 Test UTF-8"
Format="QrCode"
CharacterSet="UTF-8" />
The CharacterSet property defaults to "UTF-8" if not specified. Other common values include "ISO-8859-1", "Shift_JIS", etc., depending on your barcode format requirements.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-android36.0 net10.0-android36.0 is compatible. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-ios26.0 net10.0-ios26.0 is compatible. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-maccatalyst26.0 net10.0-maccatalyst26.0 is compatible. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. net10.0-windows10.0.19041 net10.0-windows10.0.19041 is compatible. |
Showing the top 5 NuGet packages that depend on ZXing.Net.Maui.Controls:
| Package | Downloads |
|---|---|
|
ItEnterprise.Maui.Scanning
ItEnterprise scanning library for MAUI |
|
|
EasyUIBase
MAUI navigation page with basic template. |
|
|
PlutoFramework
All in one framework for creating web3 mobile applications. |
|
|
YK.MauiSsm.Common
接口、基类、数据库、网络服务等 |
|
|
YK.Maui.Utility
日志、异常通用处理外加一些常用功能的扩展 |
Showing the top 4 popular GitHub repositories that depend on ZXing.Net.Maui.Controls:
| Repository | Stars |
|---|---|
|
simpleidserver/SimpleIdServer
OpenID, OAuth 2.0, SCIM2.0, UMA2.0, FAPI, CIBA & OPENBANKING Framework for ASP.NET Core
|
|
|
Strypper/mauisland
MAUIsland 🏝️ is the number 1 controls gallery for .NET MAUI
|
|
|
dotnet/maui-labs
Experimental and pre-release tools for .NET MAUI
|
|
|
dorisoy/Dorisoy.SIOT
一款利用.NET 8.0和MAUI框架打造的跨平台牙科治疗机物联网移动端应用,实现了对水温Speedometer监测、高速手机转速RadialGauge显示、电动马达功率检测以及光纤灯光亮度调节等功能的数据采集与仪表盘实时展示,同时支持数据可视化检测和远程操控管理。
|
| Version | Downloads | Last Updated |
|---|---|---|
| 0.10.1 | 2,566 | 6/19/2026 |
| 0.10.0 | 1,345 | 6/17/2026 |
| 0.9.0 | 1,218 | 6/15/2026 |
| 0.8.2 | 1,072 | 6/12/2026 |
| 0.8.1 | 435 | 6/11/2026 |
| 0.8.0 | 356 | 6/11/2026 |
| 0.7.4 | 104,395 | 1/13/2026 |
| 0.7.3 | 4,764 | 1/7/2026 |
| 0.7.2 | 9,214 | 12/18/2025 |
| 0.7.1 | 1,631 | 12/16/2025 |
| 0.7.0 | 12,436 | 12/8/2025 |
| 0.6.0 | 69,535 | 10/20/2025 |
| 0.5.2 | 118,443 | 9/12/2025 |
| 0.5.1 | 1,157 | 9/11/2025 |
| 0.5.0 | 9,710 | 9/5/2025 |
| 0.5.0-preview.2 | 996 | 8/28/2025 |
| 0.5.0-preview.1 | 294 | 8/27/2025 |
| 0.4.0 | 1,024,062 | 10/24/2023 |
| 0.3.0-preview.1 | 87,338 | 11/10/2022 |
| 0.2.0-preview.2 | 22,928 | 10/21/2022 |