public ItemDetailViewModel(ItemDetails item = null) { Title = item.Title; item.ImageUri = new UriImageSource { Uri = new Uri(item.ImageIcon) }; Item = item; }
public DiscountPage(ItemDetails itemDetails) { InitializeComponent(); /*Item = new Item * { * Title = "Item name", * Description = "This is an item description." * };*/ details = itemDetails; BindingContext = this; }
// Note - The Xamarin.Forms Previewer requires a default, parameterless constructor to render a page. public ItemDetailPage() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); var item = new ItemDetails { Title = "Item 1", Description = "This is an item description." }; viewModel = new ItemDetailViewModel(item); BindingContext = viewModel; }
public async Task <ItemDetails> GetItemAsync(int id) { List <ItemDetails> item = new List <ItemDetails>(); ItemDetails itemDetails = new ItemDetails(); if (CrossConnectivity.Current.IsConnected) { var json = await client.GetStringAsync($"api/get-details/{id}"); item = await Task.Run(() => JsonConvert.DeserializeObject <List <ItemDetails> >(json)); if (item != null && item.Count > 0) { itemDetails = item.ToArray()[0]; } } return(itemDetails); }