(Related) I have found here, here, and here are questions describing a related problem of ZXingBarcodeImageView rendering a blurry QR code in Xamarin Forms - but they have not lead to a solution for my problem.
The Problem
I am using ZXing to draw and display a QR Code in Xamarin forms, but the QR code it produces is blurry.
The reason is in the .xaml
page I am setting the ZXingBarcodeImageView properties WidthRequest=300
and HeightRequest=300
. This is stretching the QR code after it is drawn by the ZXing library:
<forms:ZXingBarcodeImageView
IsVisible="True"
x:Name="QRCodeView"
BarcodeFormat="QR_CODE"
HeightRequest="300" //Stretching Height
WidthRequest="300" //Stretching Width
BarcodeValue="-1"
/>
This question's top answer suggests binding the attributes Height
and Width
ahead of time but no matter how I change the parameters in the BarcodeOptions
array it suggests, the QR code stays the same.
How do I change to the setup dimensions of the ZXingBarcodeImageView before drawing time to avoid the stretching?