Customization in WinUI Barcode

14 Apr 20212 minutes to read

Background

The Barcode background color can be changed using Background property.

<syncfusion:SfBarcode x:Name="barcode" Background="Orange" Value="1010111011" Height="150" Width="250">  
    <syncfusion:SfBarcode.Symbology>  
        <syncfusion:CodabarBarcode />  
    </syncfusion:SfBarcode.Symbology>  
</syncfusion:SfBarcode>

Foreground

The Barcode foreground color can be changed using Foreground property.

<syncfusion:SfBarcode x:Name="barcode" Foreground="White" Value="1010111011" Height="150" Width="250">  
    <syncfusion:SfBarcode.Symbology>  
        <syncfusion:CodabarBarcode />  
    </syncfusion:SfBarcode.Symbology>  
</syncfusion:SfBarcode>

Barcode_Customization

NOTE

In order for a barcode symbol to be recognized by a scanner, there must be an adequate contrast between the dark bars and the light spaces and not all the barcode scanners have support for colored barcodes.

Module

The width ratio of the wide and narrow bars can be customized using Module property.

<syncfusion:SfBarcode x:Name="barcode" Module="1" Value="48625310" ShowValue="False" Height="150">  
    <syncfusion:SfBarcode.Symbology>  
        <syncfusion:CodabarBarcode />  
    </syncfusion:SfBarcode.Symbology>  
</syncfusion:SfBarcode>

Module

AutoModule

The QRBarcode and DataMatrixBarcode can be rendered based on the available control size if AutoModule is set to True.

<syncfusion:SfBarcode x:Name="barcode" Width="400" Height="400"
AutoModule="True" ShowValue="False" Value="QRBarcode">
    <syncfusion:SfBarcode.Symbology>   
        <syncfusion:QRBarcode />   
    </syncfusion:SfBarcode.Symbology>   
</syncfusion:SfBarcode>

AutoModule

Rotation Angle

The Barcode rotation can be changes by using RotationAngle property. The different angles can be set to Barcode using BarcodeRotation enum values.

The BarcodeRotation enumeration has following four angles,

BarcodeRotation Description

Angle 0

Barcode can be rotated by 0 degree.

Angle 90

Barcode can be rotated by 90 degree.

Angle 180

Barcode can be rotated by 180 degree.

Angle 270

Barcode can be rotated by 270 degree.
<syncfusion:SfBarcode x:Name="barcode" RotationAngle="Angle90" Value="1010111011" Height="150" Width="250">  
    <syncfusion:SfBarcode.Symbology>  
        <syncfusion:CodabarBarcode />  
    </syncfusion:SfBarcode.Symbology>  
</syncfusion:SfBarcode>

RotationAngle