title: Get a list of images of BindableLayout in Xamarin
body: <p>I have a question <a href="https://stackoverflow.com/questions/70045124/how-to-check-list-of-selected-images-bindablelayout-in-xamarin">here</a>, however the problem is not solved perfectly. I posted another question for more clarity.</p>
  <p>I'm trying to upload an image through the API. As in the code below, I have an image selector button, the list shows the selected images. And 1 button to post the image.</p>
  <p>I have a list of pictures:</p>
  <pre><code>&lt;Grid x:Name=&quot;pickimg&quot; Grid.Row=&quot;0&quot; Grid.Column=&quot;1&quot; HorizontalOptions=&quot;End&quot; VerticalOptions=&quot;Center&quot;&gt;
      &lt;StackLayout Orientation=&quot;Horizontal&quot;&gt;
          &lt;Image Margin=&quot;0&quot;&gt;
              &lt;Image.Source&gt;
                  &lt;FontImageSource Color=&quot;#ddd&quot; Size=&quot;22&quot; FontFamily=&quot;MaterIcon&quot; Glyph=&quot;{x:Static local:FontIconsClass.Camera}&quot;/&gt;
              &lt;/Image.Source&gt;
          &lt;/Image&gt;
      &lt;/StackLayout&gt;
      &lt;Grid.GestureRecognizers&gt;
          &lt;TapGestureRecognizer Tapped=&quot;pickimg_Tapped&quot; /&gt;
      &lt;/Grid.GestureRecognizers&gt;
  &lt;/Grid&gt;
  
  &lt;StackLayout x:Name=&quot;listImg&quot; Orientation=&quot;Horizontal&quot;&gt;
      &lt;BindableLayout.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;Frame HasShadow=&quot;False&quot; Padding=&quot;0&quot; IsClippedToBounds=&quot;True&quot; CornerRadius=&quot;4&quot;&gt;
                  &lt;Image HeightRequest=&quot;70&quot; WidthRequest=&quot;70&quot; Aspect=&quot;AspectFill&quot; Source=&quot;{Binding .}&quot;/&gt;
              &lt;/Frame&gt;
          &lt;/DataTemplate&gt;
      &lt;/BindableLayout.ItemTemplate&gt;
  &lt;/StackLayout&gt;
  &lt;Button x:Name=&quot;bt_addfeed&quot; Clicked=&quot;bt_addfeed_Clicked&quot; CornerRadius=&quot;7&quot; FontSize=&quot;13&quot; Text=&quot;Post&quot; HorizontalOptions=&quot;Fill&quot;/&gt;
  </code></pre>
  <p>.xaml.cs</p>
  <pre><code>List&lt;ImageSource&gt; imgList = new List&lt;ImageSource&gt;();
  
  async void pickimg_Tapped(System.Object sender, EventArgs e)
  {
      var pickResult = await MediaGallery.PickAsync(5, MediaFileType.Image);
      if(pickResult?.Files == null)
      {
          return;
      }    
      else
      {
          //var imgList = new List&lt;ImageSource&gt;();
          foreach (var img in pickResult?.Files)
          {
              var stream = await img.OpenReadAsync();
              imgList.Add(ImageSource.FromStream(() =&gt; stream));
          }
          BindableLayout.SetItemsSource(listImg, imgList);
      }    
  }
  
  private async void bt_addfeed_Clicked(object sender, EventArgs e)
  {
      var getResult = imgList;
      if (getResult == null)
      {
          return;
      }
      else
      {
          foreach(var img in getResult)
          {
              var content = new MultipartFormDataContent();
              content.Add(new StreamContent(await img.OpenReadAsync()), &quot;file&quot;, img.FileName);
          
              var httpClient = new HttpClient();
              var responses = await httpClient.PostAsync(&quot;xxxx/api/UploadFileFeeds&quot;, content);
          }
      }
  }
  </code></pre>
  <p>How <code>img.FileName</code>? and <code>img.OpenReadAsync()</code>?</p>
  <p>Please help, thanks</p>