Xamarin Camera RRS feed

  • Question

  • User370985 posted

    Hi, i wanna show the camera on xaml file, for example in stacklayout, but i can´t find an example. The only examples are about how to display de camera device.

    Friday, August 3, 2018 7:15 PM

All replies

  • User2148 posted

    Xamarin Forms does not have a Camera control

    I think you have to add a platform specific control. For example in android you can follow


    Friday, August 3, 2018 7:27 PM
  • User370985 posted

    Thanks for your help, i solved the problem using custom renderer and using some android functions

    Monday, August 6, 2018 8:46 PM
  • User145893 posted

    While I see you were able to make your implementation for a camera control for Android, if you are interested in a ready control you can use across multiple platforms in your software, the LEADTOOLS toolkit has recently introduced a Xamarin Camera Control that can help in simplifying the process of acquiring images from camera and processing them (Disclaimer: I am an employee of this toolkit’s vendor)

    Check out this article for details and code samples on how to use this control: https://www.codeproject.com/Articles/1349139/Finally-a-Camera-Control-for-Xamarin-2

    Once you have configured this control in your app, you can set the event handler for leadCamera.PictureReceived and implement the code to process the image from the camera using other classes from the toolkit.

    For example, you could implement the BarcodeEngine().Reader method from the toolkit to recognize barcodes from the captured image:

    private void LeadCamera_PictureReceived(FrameHandlerEventArgs e)

    Where the code to read barcodes will look like this:

    public void ReadBarcode(RasterImage image)
       var reader = new BarcodeEngine().Reader;
       var dataArray = reader.ReadBarcodes(image, LeadRect.Empty, 0, null);
       var sb = new StringBuilder();
       foreach (var data in dataArray)
          sb.AppendLine($@"Symbology: {data.Symbology} Location: {data.Bounds.ToString()} Data: {data.Value}");
       Device.BeginInvokeOnMainThread(() =>
          DisplayAlert("Found Barcode(s)", sb.ToString(), "OK");

    If you are interested in checking this out, you can find a free evaluation here: https://www.leadtools.com/downloads?category=main

    Wednesday, May 1, 2019 3:08 PM