I am trying to load an image from a url string. Below code is an array of items, where Photo is what loads the image. Normally I included the image from my hard disk and loaded that image in by Photo = "image_name.jpg"
This is the first code:
public MainPageViewModel()
{
items.Add(new CardStackView.Item() { Name = "Title 1", Photo = " xxx ", Description = "Desc 1" });
items.Add(new CardStackView.Item() { Name = "Title 2", Photo = " xxx ", Description = "Desc 2" });
items.Add(new CardStackView.Item() { Name = "Title 3", Photo = " xxx ", Description = "Desc 3" });
items.Add(new CardStackView.Item() { Name = "Title 4", Photo = " xxx ", Description = "Desc 4" });
items.Add(new CardStackView.Item() { Name = "Title 5", Photo = " xxx ", Description = "Desc 5" });
items.Add(new CardStackView.Item() { Name = "Title 6", Photo = " xxx ", Description = "Desc 6" });
}
I want xxx to be my url example https://i.vimeocdn.com/portrait/58832_300x300.
This piece of code is where I display the image:
Photo = new Image()
{
InputTransparent = true,
Aspect = Aspect.Fill,
Scale = 0.95
};
view.Children.Add(Photo,
Constraint.RelativeToParent((parent) => { double w = parent.Width * 1; return ((parent.Width - w) / 2); }),
Constraint.Constant(10),
Constraint.RelativeToParent((parent) => { return parent.Width; }),
Constraint.RelativeToParent((parent) => { return (parent.Height* 0.80); }));
Please note that these two pieces of code is not in the same file, but in two separate files.
I hope this isn't a duplicate, because I have not been able to find any solution to my problem.