Version

Adding Barcode Using XAML Code

Before You Begin

This topic is designed to get you up and running as quickly as possible by describing the basic steps required for adding a XamQRCodeBarcode™ control to your application using XAML.

What You Will Accomplish

You will add a basic XamQRCodeBarcode™ control to your application.

Follow these Steps

  1. Create a Xamarin.Forms application project.

  2. Add References Through NuGet Packages.

Note
Note:

Add support for the CJK encoding to your project.

For Android project - open Android project properties – select Android Options tab - Additional supported encodings – check CJK encoding.

xamBarcode Android Encodings.png

For iOS project - open iOS Project properties – select iOS Build tab - Internationalization – Codesets – check cjk codeset.

xamBarcode iOS Codesets.png
  1. Add an XML namespace declaration for XamQRCodeBarcode:

In XAML:

xmlns:ig="clr-namespace:Infragistics.XamarinForms.Controls.Barcodes;assembly=Infragistics.XF.Barcodes"
  1. Choose a barcode symbology, and add an instance to the StackLayout named LayoutRoot.

Supported Symbology Types:

In XAML:

<StackLayout x:Name="LayoutRoot">
    <ig:XamQRCodeBarcode x:Name="Barcode" />
</StackLayout>
  1. Assign a value to the control’s Data property

In XAML:

<ig:XamQRCodeBarcode x:Name="Barcode" Data="QRBarcode" />
  1. Save and run your application.