Getting Started with UWP Barcode

Add barcode control to an application

The following assembly reference is required for deploying Barcode.

Namespace: Syncfusion.UI.Xaml.Controls.Barcode

Assembly: Syncfusion.SfBarcode.UWP

To create the SfBarcode control in Visual Studio:

  1. Create a new UWP project.

  2. Drag the SfBarcode control from the Toolbox window to the Design View. An instance of the SfBarcode control is created in the Design view.

    UWP Barcode Control

    SfBarcode Control after Dragging to Design View

The following code example shows how to create the Barcode control from XAML:

<Page
    x:Class="GettingStarted.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:GettingStarted"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:sync="using:Syncfusion.UI.Xaml.Controls.Barcode">

    <Grid>
        <sync:SfBarcode x:Name="barcode" Text="http://www.syncfusion.com" Symbology="QRBarcode">
            <sync:SfBarcode.SymbologySettings>
                <sync:QRBarcodeSetting XDimension="8"/>
            </sync:SfBarcode.SymbologySettings>
        </sync:SfBarcode>
    </Grid>

</Page>

Text

The text to be encoded can be set using the Text property. By default, this original text will be displayed at the bottom of the barcode. The location of the text can be toggled between top and bottom using the TextLocation property. The horizontal alignment of the text can be set using TextAlignment. The text brush and various other font customizations can also be done using the built-in font properties. Optionally, the user can hide the barcode text by setting the DisplayText property to false.

<sync:SfBarcode x:Name="barcode" Text="http://www.syncfusion.com" DisplayText="False" Symbology="QRBarcode"/>

Rotation

Barcode control can be rotated to save space by using the Rotation property. The barcode can be rotated to 90, 180 and 270 degrees.