https://www.c-sharpcorner.com/article/embedding-qr-code-scanner-in-xamarin-forms/Dropdown in Xamarin.Forms
ZXing.Net.Mobile plugin is a useful plugin to facilitate scanning barcodes as effortlessly and painlessly as possible in our own applications works Xamarin.iOS, Xamarin.Android, Tizen, and UWP.
Library Link: https://github.com/Redth/ZXing.Net.Mobile
Without much introduction, we will skip into the coding part of this article.
Coding Part
Here, I will explain the steps to create Dropdown in Xamarin.Forms.
- Step 1: Creating a new Xamarin.Forms Projects.
- Step 2: Setting up the scanner in Xamarin.Forms .Net Standard Project
- Step 3: Implementation of QR Code Scanner inside the screen/page
Step 1 - Creating new Xamarin.Forms Projects
Create New Project by Selecting New -> Project -> Select Xamarin Cross Platform App and Click OK.
Note
Xamarin.Forms version should be greater than 4.5.
Then select Android and iOS Platforms as shown below with Code Sharing Strategy as PCL or .Net Standard and click OK.
Step 2 - Setting up the scanner in Xamarin.Forms .Net Standard Project
In this step, we will see how to setup the plugin.
Open the Nuget Manager in the Visual Studio Solution by right clicking the solution and select “Manage Nuget Packages”.
Then “ZXing.Net.Mobile” and check all the projects in the solution, install the plugin
After the installation, we need to do some additional setup in the platform wise projects.
In Android, update the below code blocks in the MainActivity to initialize the plugin.
Step 3 - Implementation of QR Code Scanner inside the screen/page
In this step, we will see how to use the view in Xamarin.Forms.
Open your designer file and in my case MainPage.xaml and add the ZxingSannerView as shown below.
Add Label below the ZxingSannerView to see the results when the bar/QR code is scanned.
Then add the below event to know the successful scan from the control.
Full Code implementation of ZXing Scanner View in MainPage
Here, we will see the full code for Main Page.
Demo
The following screens show the output of this tutorial and it is awesome to have this dropdown in Xamarin.Forms
No hay comentarios:
Publicar un comentario