Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

local or embedded image binding from a list

$
0
0

I have the following xaml but I don't succeed in displaying the image.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:design="clr-namespace:MRApp;assembly=MRApp"
             xmlns:cv="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.CarouselView"
             xmlns:local="clr-namespace:MRApp.Helpers;assembly=MRApp"
             BindingContext="{x:Static design:common.Artistworks}"
             x:name="ArtistPage"
             x:Class="MRApp.ArtistPage">

  <ContentPage.Content>
    <StackLayout>
        <cv:CarouselView x:Name="CarouselImage" ItemsSource="{Binding Path=BindingContext.L}, Source={x:Reference ArtistPage}" HeightRequest="200">
          <cv:CarouselView.ItemTemplate>
            <DataTemplate>
              <StackLayout>
                <!--<Image Source="{Binding Img}" />-->
                <!--<Image Source="{local:ImageResource MRApp.Images.322Cirillo1.jpg}" />-->
                <Image>
             <Image.Source>
                <OnPlatform x:TypeArguments="ImageSource">
                  <OnPlatform.iOS>
                    <FileImageSource File="{Binding Img}"/>
                  </OnPlatform.iOS>
                  <OnPlatform.Android>
                    <FileImageSource File="{Binding Img}"/>
                  </OnPlatform.Android>
                  <OnPlatform.WinPhone>
                    <FileImageSource File="{Binding Img}"/>
                  </OnPlatform.WinPhone>
                </OnPlatform>
              </Image.Source>
                </Image>

              <!--<Image>
                  <Image.Source>
                    <FileImageSource File="{Binding Img}"  />
                  </Image.Source>
                  </Image>-->
                <Label TextColor="White" Text="{Binding Ttl}" FontSize="16" HorizontalOptions="Center" VerticalOptions="CenterAndExpand"/>
                </StackLayout>
            </DataTemplate>
          </cv:CarouselView.ItemTemplate>
        </cv:CarouselView>
      <Label TextColor="White" Text="{Binding Ttl}" FontSize="16" HorizontalOptions="Center" VerticalOptions="CenterAndExpand"/>
    </StackLayout>
  </ContentPage.Content>
</ContentPage>

the images are in the directory Resources/drawable/Images and I provide a string with Images.imagename.jpg

What's wrong?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>