C# Xamarin load image from url -


i trying load image url string. below code array of items, photo loads image. included image hard disk , loaded image in photo = "image_name.jpg"

this 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 url example https://i.vimeocdn.com/portrait/58832_300x300.

this piece of code display 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 these 2 pieces of code is not in same file, in 2 separate files.

i hope isn't duplicate, because have not been able find solution problem.

you need set source of image element:

photo = new image() {     inputtransparent = true,     aspect = aspect.fill,     scale = 0.95,     source = "https://your_image_url.com/the_image.png" }; 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -