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>