Customization in WinUI Barcode

9 Jul 20262 minutes to read

Background

The Barcode background color can be changed using the 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 the 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

To be recognized by a scanner, a barcode symbol must have adequate contrast between the dark bars and the light spaces. Not all barcode scanners support colored barcodes.

Module

The width ratio of the wide and narrow bars can be customized using the Module property for supported (linear) symbologies.

<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 render based on the available control size when 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 changed by using the RotationAngle property. Various angles can be set for the Barcode using the BarcodeRotation enumeration values.

The BarcodeRotation enumeration has the following four angles:

BarcodeRotation Description

Angle 0

Barcode can be rotated by 0 degrees.

Angle 90

Barcode can be rotated by 90 degrees.

Angle 180

Barcode can be rotated by 180 degrees.

Angle 270

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

RotationAngle