Telerik blogs
XamarinT2 Dark_1200x303

With the R3 2021 release of Telerik UI for Xamarin, we’ve added a new component to the Barcode family, namely Data Matrix.

Barcodes can be found everywhere—no matter whether it is on the shipping package in logistics, on an invoice in accounting or on a component parts in industrial factories. They are widely used to help quickly share specific information.

With the R3 2021 release of Telerik UI for Xamarin suite, we’ve expanded our Barcode control to include a new Data Matrix component. Together with the QR Code and PDF417, DataMatrix is among the most popular two-dimensional barcode symbologies. DataMatrix is also available in our UI for WinUI, UI for WPF and UI for WinForms suites.


General Info on Data Matrix

Data Matrix is a very efficient, two-dimensional (2D) barcode symbology consisting of black and white “cells,” or dots, arranged in either a square or rectangular pattern, also known as a matrix. The information to be encoded can be text or numeric data. With a usual data size from a few bytes up to 1,556 bytes (or up to up to 2,335 alphanumeric characters), DataMatrix barcode is one of the smallest barcodes while encoding the same data as other barcodes.

Every Data Matrix is composed of two solid adjacent borders in an “L” shape (called the “finder pattern”) and two other borders consisting of alternating dark and light “cells” or modules (called the “timing pattern”). Within these borders are rows and columns of cells encoding information. The finder pattern is used to locate and orient the data matrix while the timing pattern provides a count of the number of rows and columns in the matrix.


Data Matrix Advantages

What are the specific benefits of Data Matrix over other 2D barcodes?

  • Occupies less space: Data Matrix has the ability to encode large amount of data in a small area.
  • High fault tolerance: Data Matrix code includes an error-correction algorithm, making it able to reconstruct up to 30% of a damaged code image.
  • Readability even with low contrast: A contrast of only 20% can be sufficient to successfully read the barcode.
  • Read easily: It can be read in any position (0-360°).


As always, we have ensured to provide you with various configuration options, so you get the exact DataMatrix barcode you need.  Let’s quickly go through the list of the available settings:


The Encodation property determines the type of content encoded by the DataMatrix barcode. It’s important to choose the proper encodation, as this reduces the barcode size and improves readability. Possible options are ASCII, Text and C40. Details on each of these can be found in our documentation here: Data Matrix Symbology Encodation.

Symbol Size

Although the most popular DataMatrix is square, similar to the QR code, you also have the option to define it as a rectangle. This is controlled through the SymbolSize property. In addition to the shape, you can choose whether the size should be automatically determined by using “SquareAuto” or “RectangleAuto,” or manually define it by using values such as Square32x32 or Rectangle16x48.


Text Encoding

The TextEncoding property defines character encoding used to encode the barcode contents. By default, it is set to UTF-8, which uses more bits per character and may increase the size of the barcode image. TextEncoding is of type System.Text.Encoding and you can check the available values in MS Docs: System.Text.Encoding Class.

Let’s See It in Action

Let’s add a simple DataMatrix barcode to the Xamarin.Forms page.

  1. Add a reference to the Telerik.UI.for.Xamarin NuGet package from the Telerik NuGet Server.
  2. Register the required for the Barcode namespace:

  3. Add the RadBarcode definition to the page with the DataMatrix symbology applied:

    <telerik:RadBarcode x:Name="dataMatrix">
            <telerik:DataMatrix Encodation="Ascii"
                         SymbolSize="SquareAuto" />
  4. Set the information that needs to be encoded through the Data Matrix.  For our example, I will encode some information on the Telerik UI for Xamarin product:

    string productName = "Product Name: Telerik UI for Xamarin";
    string productPage = "Product Page:";
    string documentation = "Documentation:";
    string release = "Recent Release: R3 2021";
    dataMatrix.Value = $"{productName}\n{productPage}\n{documentation}\n{release}";
  5. Check the result in Android emulator:


    Try It Out and Share Your Feedback

    The R3 2021 release is available for download in customers’ accounts. If you are new to Telerik UI for Xamarin, you can learn more about it via the product page. It comes with a 30-day free trial, giving you some time to explore the toolkit and consider using it for your current or upcoming Xamarin development.

    We would love to hear what you think, so should you have any questions and/or comments, please share them in our Telerik UI for Xamarin Feedback Portal.

About the Author

Yana Kerpecheva

Yana Kerpecheva is a Senior Technical Support Engineer on the Telerik UI for Xamarin team. She has been working with Telerik products since 2008, when she joined the company. Apart from work, she likes skiing and travelling to new places.

Related Posts


Comments are disabled in preview mode.