c# - How to download image from Azure Blob into XAML -
i have public azure blob storage container trying pull down .jpg file , display on xaml control on interface. here code far:
/* handling picture */ // setting blob uri here uri bloburi2 = new uri("https://fake_name.blob.core.windows.net/container/test.jpg"); // creating new cloudblockblob object (passing blob uri param) cloudblockblob picblob = new cloudblockblob(bloburi); /***** waiting more ******/
what best approach this? have seen several examples of images being pulled down , saved user's machine have no idea how display on image xaml control.
update: trying change image source on c# blob uri.
image.source = https://fake_name.blob.core.windows.net/container/test.jpg;
getting errors. visual studio expecting ';' , '}' after statement. guess url confusing compiler. putting url in double quotes not option since vs takes string , shows error. workarounds? adding pic on xaml not viable because want modify content app goes along...
solved: code below
image.source = new bitmapimage(uri_here);
assuming don't have security on blob can load image in image control
<image source="https://fake_name.blob.core.windows.net/container/test.jpg"/>
update:
if need set the image code, need use bitmapimage can initialize uri have
var bi = new bitmapimage(new uri("https://fake_name.blob.core.windows.net/container/test.jpg")); _image.source = bi;
Comments
Post a Comment