Customization in WinUI Barcode
28 Feb 20222 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>
NOTE
To be recognized by a scanner, a barcode symbol must have adequate contrast between the dark bars and the light spaces, and not all barcode scanners support colored barcodes.
Module
The width ratio of the wide and narrow bars can be customized using the 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>
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>
Rotation angle
The Barcode rotation can be changed by using theRotationAngle property. The various angles can be set to Barcode using BarcodeRotation enum values.
The BarcodeRotation enumeration has following four angles:
BarcodeRotation | Description |
---|---|
Barcode can be rotated by 0 degrees. | |
Barcode can be rotated by 90 degrees. | |
Barcode can be rotated by 180 degrees. | |
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>