Forum Xamarin.Forms

how to bind ImageSource use C# code

private ObservableCollection<bookData> bookList;

public class bookData
   {
        public int s_number { get; set; }
        public string title { get; set; }
        public int price { get; set; }
        public int inventory { get; set; }
        public string genre { get; set; }
        public string explanation { get; set; }
        public ImageSource image { get; set; }
    }
grid.Children.Add(new Frame
            {
                BackgroundColor = Xamarin.Forms.Color.White,
                Padding = 5,
                HasShadow = false,
                Content = new Image
                {
                    Source = /*ImageSource*/,
                    Aspect = Aspect.AspectFill,
                    HorizontalOptions = LayoutOptions.Center,
                    VerticalOptions = LayoutOptions.Center,
                    HeightRequest = 80,
                }
            });

I want bind ImageSource in 'new Image' use C# code. I'm going to use 'image' in 'bookList' to ImageSource. How can i do that?

Best Answer

Answers

  • doqltl179doqltl179 Member ✭✭
    edited November 2020

    @Jarvan Thank you for your comment! that is helped me.

Sign In or Register to comment.