title: Xamarin Forms - Xamarin Forms Labs Camera on Page Showing Up
body: <p>Does anyone have an example in Xamarin.Forms of Xamarin.Forms.Labs' Camera function?</p>
  
  <p>I tried to get it working, but it does not seem to work at all.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>public partial class CameraPictureInfoPage : ContentPage
  {   
      public CameraPictureInfoPage ()
      {
          Image img = new Image ();
          this.Appearing += async (s, e) =&gt; {
              img.Source = await GetPicture (true);
          };
  
  
          this.Content = new StackLayout {
              Orientation = StackOrientation.Vertical,
              VerticalOptions = LayoutOptions.Center,
              WidthRequest = 250,
              Padding = 40, Spacing = 10,
              Children = {
                  img
              }
          };
      }
  
  
      async Task&lt;ImageSource&gt; GetPicture(bool chooseNotTake){
          var mediaPicker = DependencyService.Get&lt;IMediaPicker&gt; (); 
          ImageSource imgSource  = null;
          if (mediaPicker != null) {
              Task&lt;MediaFile&gt; pick;
              if (chooseNotTake) {
                  pick = mediaPicker.TakePhotoAsync (new CameraMediaStorageOptions {
                      DefaultCamera = CameraDevice.Rear, 
                      MaxPixelDimension = 1024,
                  });
              } else {
                  pick = mediaPicker.SelectPhotoAsync (new CameraMediaStorageOptions{ MaxPixelDimension = 1024 });
              } 
  
              await pick.ContinueWith (t =&gt; {
                  if (!t.IsFaulted &amp;&amp; !t.IsCanceled) {
                      var mediaFile = t.Result; 
                      MemoryStream mstr = new MemoryStream ();
                      mediaFile.Source.CopyTo (mstr);
                      imgSource = ImageSource.FromStream (() =&gt; mstr); 
                  }
                  return imgSource; 
              });
          }
  
          return imgSource;
      }
  }
  </code></pre>