Tritium UI
TritiumBarcodeScanner
Accept a barcode from a keyboard wedge, a still image, or a live camera after the user grants permission.
Key features
- Type or wedge a code into the entry and raise BarcodeDetected with the raw value, the format name, and the source (keyboard, camera, or image).
- Keep the camera off until the page calls RequestEnableCameraAsync, which asks the user and requests the camera permission.
- Decode a still image from a stream on every supported platform, including Windows, where live camera scanning is not available.
- Show a live camera preview only when the device reports a usable camera (Android, iOS, and Mac Catalyst).
- Bind the last accepted value two-way so a form can store the scan.
- Stop the camera when the control unloads.
Platforms
Keyboard wedge and still-image decode: Android, iOS, Mac Catalyst, and Windows 10 version 19041 and later. Live camera: Android, iOS, and Mac Catalyst when a camera is reported; Windows has no live camera scan. The camera opens only after RequestEnableCameraAsync and a granted camera permission.
Main API
- Value . Last accepted barcode text, two-way.
- IsCameraEnabled . Turns the live preview on after permission; defaults to false.
- BarcodeDetected . Fires with the value, format, and source (keyboard, camera, or image).
- RequestEnableCameraAsync . Prompts for camera access and starts the preview, or returns false if unsupported or denied.
Basic example
Declare this namespace on the page.
xmlns:barcode="clr-namespace:Tritium.Maui.Barcode;assembly=Tritium.Maui.Barcode"
<barcode:TritiumBarcodeScanner
x:Name="Scanner"
Placeholder="Scan or type a barcode"
BarcodeDetected="OnBarcodeDetected" /> Add the package source from your license, then reference the package that includes this control. These packages are not on the public NuGet Gallery.