Xaml Page-----
<Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
</Grid.RowDefinitions>
<Image x:Name="img_Ingrediants" Grid.Row="0" Grid.Column="0" Source="{Binding Ingredients.image}" />
<Label x:Name="lbl_Ing_Name" Grid.Row="0" Grid.Column="1" Text="{Binding Ingredients.name}"/>
<Label x:Name="lbl_original" Grid.Row="0" Grid.Column="2" Text="{Binding Ingredients.originalString}"/>
</Grid>
View Model--
public class RecipieGetItems
{
public string aggregateLikes { get; set; }
public List extendedIngredients { get; set; }
public string id { get; set; }
public string image { get; set; }
public string instructions { get; set; }
public string readyInMinutes { get; set; }
public string servings { get; set; }
public string sourceName { get; set; }
public string sourceUrl { get; set; }
public string spoonacularSourceUrl { get; set; }
public string title { get; set; }
public string sustainable { get; set; }
public bool vegetarian { get; set; }
public bool vegan { get; set; }
public bool veryHealthy { get; set; }
public bool veryPopular { get; set; }
public bool dairyFree { get; set; }
public bool glutenFree { get; set; }
public List analyzedInstructions { get; set; }
}
public class Ingredients
{
public string aisle { get; set; }
public string amount { get; set; }
public string consistency { get; set; }
public string image { get; set; }
public string name { get; set; }
public string originalString { get; set; }
public string unit { get; set; }
public string id { get; set; }
}
C# code
public void DisplayRecipeDetail()
{
objModel = BindRecipeDetails();
Device.BeginInvokeOnMainThread(() =>
{
RecipeDetails111.ItemsSource = objModel;
});
}
List BindRecipeDetails()
{
List objModelLst = new List();
try
{
RecipieGetItems objModel = new RecipieGetItems();
var response = recipieSearchItem.GetRecipiesDetails(id, BaseClass.Token);
CustomResponse objdata = JsonConvert.DeserializeObject<CustomResponse>(response.ToString());
objModel = JsonConvert.DeserializeObject(objdata.parameters);
objModelLst.Add(objModel);
}
catch (Exception ex)
{
Toast.MakeText(_context, ex.Message, ToastLength.Long).Show();
}
return objModelLst;
}