Barcode Software and Fonts for Windows Phone

Windows Phone OS is a mobile operating systems developed by Microsoft featuring "Live Tiles". The "Live Tiles" are links to apps, web pages or other media items that could display live updates to the underlying items. For example, a "Live Tile" to an email app could display the number of unread messages.

The Windows Phone Software Development Kit provides tools for developers to develop apps for the Windows Phone. ConnectCode Barcode Software supports the creation of barcodes on many mobile devices including Windows Phone using barcode web fonts. It also supports the creation of barcodes in Windows Phone apps using the Windows Phone .Net SDK and True Type fonts. A .Net Windows Phone Barcode SDK is provided in the following location:

<ConnectCode Directory>\Resource\WindowsPhone\ConnectCodeWindowsPhoneBarcodeClassLibrary.dll

The class library enables the verification of input data, addition of barcode check digits and start/stop characters quickly and easily. With the use of fonts (instead of images), a resolution independent barcode that meets the strictest industry requirements can be created easily. The documentation of the class library can be found at

Creating barcodes in Windows Phone

This tutorial illustrates the use of ConnectCode Windows Phone Barcode Class Library and True Type barcode fonts to create standards compliant barcodes. It assumes the creation of a new Windows Phone C# project (other languages are also supported) in Visual Studio 2012. Pointers and tips on adding the class library and barcode fonts to the project are provided to help developers get started quickly. On top of that, developers can also use this tutorial as a reference to add barcode creation capability in their existing Windows Phone apps.
  1. Launch Visual Studio and go to File -> New -> Project. In Templates -> Visual C# -> Windows Phone, select the Windows Phone App template. Name the project "WindowsPhoneBarcodeApp" and click OK. Select Windows Phone OS 8.0 as the target platform and click on the OK button.
  2. In the Solutions Explorer, right click on References and select Add Reference. In the Reference Manager, click on the Browse button. Select the Windows Phone Barcode Class Library in the following location :

    <ConnectCode Directory>\Resource\

    Click Add followed by OK. The class library will be added to the References folder in the Solutions Explorer.

  3. Next, we are going to add the True Type barcode fonts into this Windows Phone project. ConnectCode Barcode Software also provides fonts in Open Type and Type 1 formats.

    Right click on the WindowsPhoneBarcodeApp in Solutions Explorer. Select Add -> New Folder and name the new folder as "Fonts". Launch Windows Explorer and navigate to ConnectCode (e.g. C:\Program Files\ConnectCodeTrial) directory. Select all the TrueType font files (*.ttf) in this directory and copy the files to the Fonts folder created above. The fonts folder is located in the following directory:

    C:\Users\\Documents\Visual Studio 2012\Projects\

    The Solutions Explorer should look like the following after the fonts are added.

  4. We will need to make sure that these font files are bundled together with the app when deployed.

    In Visual Studio, right click on the Fonts folder and select Add -> Existing Item. Select all the True Type (*.ttf) barcode fonts file in the Fonts directory. In the Properties dialog, set the "Copy always" option in the "Copy to Output Directory" property. The property is as shown in the following diagram.

  5. We are now ready to add the programming codes to generate barcodes. In MainPage.xaml, locate and change the TitlePanel code to the following:

    <!--TitlePanel contains the name of 
    the application and page title-->
    <StackPanel x:Name="TitlePanel" 
    Grid.Row="0" Margin="12,17,0,28">
    <TextBlock Text="ConnectCode" 
    Style="{StaticResource PhoneTextNormalStyle}" 
    <TextBlock Text="Barcode" 
    Style="{StaticResource PhoneTextTitle1Style}"/>

    Next, locate the ContentPanel and change the code to the following:

    <Grid x:Name="ContentPanel" Grid.Row="1" 
    <TextBox x:Name="textBoxOutput" Height="200" 
    <ListBox x:Name="listBox" 
    Margin="10,10,10,10" Height="85">
    <ListBoxItem IsSelected="True">Code 39</ListBoxItem>
    <ListBoxItem>Code 39 ASCII</ListBoxItem>
    <ListBoxItem>Code 128A</ListBoxItem>
    <ListBoxItem>Code 128B</ListBoxItem>
    <ListBoxItem>Code 128C</ListBoxItem>
    <ListBoxItem>Code 128Auto</ListBoxItem>
    <ListBoxItem>Code 93</ListBoxItem>
    <ListBoxItem>Modified Plessy</ListBoxItem>
    <ListBoxItem>EAN13 - Human Readable</ListBoxItem>
    <ListBoxItem>EAN8 - Human Readable</ListBoxItem>
    <ListBoxItem>UPCA - Human Readable</ListBoxItem>
    <ListBoxItem>UPCE - Human Readable</ListBoxItem>
    <ListBoxItem>GS1 Databar 14</ListBoxItem>
    <TextBox x:Name="textBox1" 
    <CheckBox x:Name="checkBox1" 
    IsChecked="True">Check Digit
    <Button HorizontalAlignment="Right" 

    The XAML code above sets up a list box for users to select and choose the different barcodes supported by the Windows Phone Barcode Class Library.

  6. In MainPage.xaml.cs, add the following Button_Click_1 function and listBox_SelectionChanged_1 function. These are the two functions that are invoked when a user selects a barcode in the list box.

    The Button_Click_1 function declares the BarcodeFonts object and uses it to encode the input data. It is also through this object that properties such as check digit and bearers bar are setup.

    The following line sets up the appropriate barcode font to be used.

    textBoxOutput.FontFamily = new System.Windows.Media.FontFamily(fontFamily);

    private void Button_Click_1(object sender
                                , RoutedEventArgs e)
    BarcodeFonts barcode = new BarcodeFonts();
    barcode.BarcodeType = BarcodeFonts.BarcodeEnum.Code39;
    barcode.CheckDigit = BarcodeFonts.YesNoEnum.No;
    if (checkBox1.IsChecked==true)
     barcode.CheckDigit = BarcodeFonts.YesNoEnum.Yes;
    string fontFamily 
    string input = "12345678";
    string barcodeType 
    if (barcodeType == "Code 39")
    barcode.Data = input;
     =new System.Windows.Media.FontFamily(fontFamily);
    textBoxOutput.FontSize = 36;
    textBoxOutput.Text = barcode.EncodedData;
    //string humanText = barcode.HumanText;
    //string eanText = barcode.EANText;
    private void listBox_SelectionChanged_1(
    		object sender
    		,SelectionChangedEventArgs e)
    string input = "12345678";
    if (listBox == null)
    string barcodeType 
    if (barcodeType == "UCCEAN")
     input = "(01)12345678";
    else if (barcodeType == "Codabar")
     input = "A123456A";
    else if (barcodeType == "GS1 Databar 14")
     input = "12401234567898";
    textBox1.Text = input;

    The listBox_SelectionChanged_1 function basically sets up different input data for the different types of barcodes.

  7. Finally, in Visual Studio click on Build -> Build Solution. If there are no errors, run the project in the Emulator and the output is shown in the diagram below. Please refer to the programming code in detail to see additional capabilities such as setting up Human Readable Text and Bearers Bar.