Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to display image in byte[] in listview

$
0
0

in page.xaml.cs i have used webservice to fetch data from sqlserver and data is present in List<> expense. List contains Image in byte[] . how will i convert it and assign it to itemsource of ListViiew and display in List view.

public partial class frmProductCatType : ContentPage
{
List fpdetails = new List();
List expense = new List();
public frmProductCatType()
{
InitializeComponent();
FlowListView.Init();

        BindingContext = new ProductCatViewModel(this);
    }
    protected async override void OnAppearing()
    {

        string url = "http://192.168.10.113:6556/api/PROD_CATE_TYPE_MASTR";

        if (response.IsSuccessStatusCode)
        {
            var json1 = await response.Content.ReadAsStringAsync();
            expense = JsonConvert.DeserializeObject<List<PROD_CATE_TYPE_MASTR>>(json1);
        }
        iList.ItemsSource = expense;
    }
}

Model

public class PROD_CATE_TYPE_MASTR
{
public int CAT_ID { get; set; }
public string CAT_TYPE { get; set; }
public string CAT_TYPE_CODE { get; set; }
public string DESCRIPITION { get; set; }
public byte[] PRODIMAGE { get; set; }
}

Page.Xaml

    <ListView.ItemTemplate>

        <DataTemplate>

            <ViewCell>

                <StackLayout Orientation="Horizontal">

                    <Image Source="{Binding PRODIMAGE}"/>

                </StackLayout>

            </ViewCell>

        </DataTemplate>

    </ListView.ItemTemplate>

</ListView>

Viewing all articles
Browse latest Browse all 204402

Trending Articles



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