title: ZXingBarcodeImageView rendering aspect ration on iOS virtual device
body: <p>I am trying to generate and display barcode in Xamarin forms using following code.</p>
  
  <pre class="lang-cs prettyprint-override"><code>barcode = new ZXingBarcodeImageView
  {
      HeightRequest = 400,
      WidthRequest = 400
  };
  barcode.BarcodeFormat = ZXing.BarcodeFormat.QR_CODE;
  barcode.BarcodeOptions.Width = 400;
  barcode.BarcodeOptions.Height = 400;
  barcode.BarcodeOptions.Margin = 10;
  barcode.BarcodeValue = "ZXing.Net.Mobile";
  
  Content = barcode;
  </code></pre>
  
  <p>The QR code is rendered fine in Android virtual device. On the other hand, in iOS device, a distorted QR code is rendered. The aspect ration of QR code rendered on iOS virtual device is not square as it supposed to be.</p>
  
  <p>The QR code rendered on Android virtual device is verified using a mobile phone.</p>
  
  <p><strong>Edit:</strong>
  Tried the following code as suggested by @wilson </p>
  
  <pre><code>        try
          {
              barcode = new ZXingBarcodeImageView
              {
                  HorizontalOptions = LayoutOptions.FillAndExpand,
                  VerticalOptions = LayoutOptions.FillAndExpand,
              };
              barcode.BarcodeFormat = ZXing.BarcodeFormat.QR_CODE;
              barcode.BarcodeOptions.Width = 500;
              barcode.BarcodeOptions.Height = 500;
              barcode.BarcodeOptions.Margin = 10;
              barcode.BarcodeValue = "ZXing.Net.Mobile";
  
              Content = barcode;
  
          }
          catch (Exception ex)
          {
              System.Diagnostics.Debug.WriteLine(ex.ToString());
          }
  </code></pre>
  
  <p>Still, I see the same problem. When I tried the example code of @wilson and it works fine on iPhone simulator. Probably I should use content view as suggested.</p>
  
  <p><strong>Edit 2</strong>
  I tried the stack layout as shown below.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               xmlns:local="clr-namespace:AZCommute"
               x:Class="AZCommute.MainPage"&gt;
      &lt;StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"&gt;
          &lt;Label Text="QR Code Generator" HorizontalOptions="Center"/&gt;
          &lt;local:QRResult x:Name="qrResult"/&gt;
      &lt;/StackLayout&gt;
  &lt;/ContentPage&gt;
  </code></pre>
  
  <p>But, it was of no help. Nothing rendered on iOS. I tried by adding <code>WidthRequest</code> and <code>HeightRequest</code> while initializing the <code>ZXingBarcodeImageView</code> as shown below.</p>
  
  <pre><code>HorizontalOptions = LayoutOptions.Fill,
  VerticalOptions = LayoutOptions.Fill,
  WidthRequest = 410,
  HeightRequest = 410,
  </code></pre>
  
  <p>Now, <code>ZXingBarcodeImageView</code> renders in iPhone simulator. But, the aspect ratio is lost (height > width ).
  <strong>Note:</strong> I am using the <code>ContentView</code> with <code>StackLayout</code></p>