Version

Adding Barcode In Code-Behind

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.

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 the following namespaces in the application.

In C#:

using Infragistics.XamarinForms.Controls.Barcodes;
  1. Choose a barcode symbology.

XamBarcode Symbology Types:

In C#:

var Barcode = new XamQRCodeBarcode();
  1. Assign a value to the control’s Data property

In C#:

Barcode.Data = "QRBarcode";
  1. Add the instance of conrol to the main view.

In C#:

this.LayoutRoot.Children.Add(Barcode);
  1. Save and run your application.