Telerik blogs
TB_TelerikComponents_1200x303-Blog-Cover

Explore the new 2D barcode type—Swiss QR code—as well as max text length for RadEntry, keyboard type in MaskedInput and more in Telerik UI for Xamarin Input controls.

Do you want all payment information to be presented in a digital format, in a QR code? And available in your mobile application? This is possible with the Telerik Swiss QR code for Xamarin. This barcode type was included in the R2 2021 official release of the Telerik UI for Xamarin. And we have more to share: The Swiss QR Code is also available in the Telerik UI for WPF, WinUI, WinForms suites, etc. 😎

swiss qr code with payable to and payable by details

What Is Swiss QR Code?

The Swiss QR Code encodes all the information necessary for a payment in a specific format and structure. Along with the printed information, the Swiss QR Code forms the payment part of the QR-bill. The allowed currencies for payments are CHF and EUR. The QR-Bill also guarantees you compliance with the regulatory requirements arising from the revised Anti-Money Laundering Ordinance.

Requirements

The Swiss QR Code symbol requires an error correction level “M,” which means a redundancy or assurance of around 15%.

In addition, the measurements of the Swiss QR Code for printing must always be 46 x 46 mm (without surrounding quiet space) regardless of the Swiss QR Code version. Depending on the printer resolution, the Swiss QR Code produced might require size adjustments.

Swiss QR Code definition in XAML:

<telerikBarcode:RadBarcode x:Name="Barcode"
WidthRequest="100"
HeightRequest="100">
<telerikBarcode:RadBarcode.Symbology>
<telerikBarcode:SwissQRCode/>
</telerikBarcode:RadBarcode.Symbology>
</telerikBarcode:RadBarcode>

The Swiss QR code standard mandates that the input provided for the generation of the barcode is strictly formatted. Both validating and generating this input are complex processes and to facilitate them you can use the SwissQRCodeValueStringBuilder helper class. Its purpose is to hold the information needed for a SwissQRCode in a type-safe manner, to validate this information and to generate the input. Through its constructor, you need to set the following properties:

  • Iban: The IBAN of the Account/Payable to.
  • Currency: The currency of the payment—CHF or EUR.
  • Creditor: The information of the contact that receives the payment.
  • Reference: The reference information for the payment.
  • AdditionalInformation: The additional information for the payment.
  • Debtor: The information of the contact that makes the payment.
  • Amount: The amount of the payment.
  • AlternativeProcedure: The alternative procedures for the payment.
SwissQRCodeValueStringBuilder qrCodeValue = new SwissQRCodeValueStringBuilder(
new Iban("CH4431999123000889012", IbanType.QRIBAN),
SwissQRCodeCurrency.EUR,
new Contact("Max Muster & Söhne",
new StructuredAddress("CH", "8000", "Seldwyla", "Musterstrasse", "123")),
new Reference(ReferenceType.QRR, "210000000003139471430009017"),
new AdditionalInformation("Order from 15.03.2021", "//S1/10/1234/11/201021/30/102673386/32/7.7/40/0:30"),
new Contact("Simon Muster", new StructuredAddress("CH", "8000", "Seldwyla", "Musterstrasse", "1")),
(decimal)1949.75,
new AlternativeProcedure("Name AV1: UV;UltraPay005;12345", "Name AV2: XY;XYService;54321"));

Once you’ve set up the SwissQRCodeValueStringBuilder, you can call its Validate method, which validates all its fields and the relationships between them. The method returns a string that contains the accumulated errors. If there are no errors, null is returned. In this case, you can call the BuildValue method of the string builder, which will build the string value to be provided to the RadBarcode.

string errors = qrCodeValue.Validate();
if (string.IsNullOrEmpty(errors))
{
this.Barcode.Value = qrCodeValue.BuildValue();
}

And the generated Swiss QR code that contains all payment information added above:

swiss qr code xamarin

Demos

You can find working examples with Telerik UI for Xamarin Swiss QR Code in out Telerik UI for Xamarin Samples App and SDK Browser app.

Improvements in Input Controls

With R2 2021 release, we also introduced additional features in the RadEntry and RadMaskedInput controls. 🤗

In RadEntry you can restrict the number of the symbols allowed to be entered in the input field using MaxLength property.

<telerikInput:RadEntry WatermarkText="Enter text" MaxLength="10" />

xamarin entry max length is demonstrated as someone types 0123456789 and then hitting another digit does not add it to the string because the length is maxed out

In addition, another improvement is: When IsPassword is set to “True,” the suggestion tab that is above the keyboard is hidden.

When we're on the First Name field, the keyboard shows entry suggestions. When we're on the password section, those entry suggestions go away.

When using MaskedInput control, we have received many requests from our customers to provide a property for setting the virtual keyboard. And now you have the option to set the keyboard using the Keyboard property.

<telerikInput:RadMaskedInput MaskType="Regex"
InvalidInputErrorText="Invalid E-Mail format!"
ErrorColor="Red"
Keyboard="Email"
WatermarkText="Enter E-mail"
Mask="{x:Static extensions:MaskExtensions.Email}"/>

And email keyboard type is displayed when Keyboard is set to Email.

masked input - on an email field, the email keyboard with @ sign comes up

Share Your Feedback 🎉

R2 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.

Telerik UI for MAUI—Preview Version

If you want to check the .NET MAUI cross-platform framework, you can visit our Telerik UI for MAUI suite, which currently is in preview stage. 😍 Telerik UI for MAUI Preview has support for Android, iOS and WinUI.

Happy coding with our controls! 😊


Dobrinka Yordanova
About the Author

Dobrinka Yordanova

Dobrinka Yordanova is a Technical Support Engineer, part of the Progress Telerik UI for Xamarin & UWP team in Sofia, Bulgaria. She holds a master's degree in Computer Systems and Technologies. Her passion is traveling around the world and exploring multicultural environments. In her spare time she likes making sushi, playing console games and hanging out with friends.

Related Posts

Comments

Comments are disabled in preview mode.