c# - Bitmap Image on Border not updating in UI -


i have wpf application images downloaded threadpool.queueuserworkitem(). in ui, have dispatchertimer, checks folder images supposed cached, , if found, suppose show them backgrounds 2 border elements , button element.

i can see files getting downloaded filepath , can step through code creates bitmapimage object, not see rendered on screen.

the relevant code pasted below..

<border x:name="leftimage"         borderbrush="transparent"         borderthickness="0"         horizontalalignment="left"         height="220"         verticalalignment="top"         width="99">     <button template="{staticresource leftarrow}"             width="20"             height="20"             horizontalalignment="left"             margin="10,0,0,0" /> </border> <border x:name="rightimage"         borderbrush="transparent"         borderthickness="0"         horizontalalignment="right"         height="220"         verticalalignment="top"         width="99"         grid.column="2">     <button template="{staticresource rightarrow}"             width="20"             height="20"             horizontalalignment="right"             verticalalignment="center"             margin="0,0,10,0" /> </border> <button x:name="center"         grid.column="1"         horizontalalignment="center"         style="{staticresource basebuttonstyle}"         verticalalignment="top"         width="400"         height="220" /> 

//showimage being called via dispatchertimer every 5 seconds private void showimage(int p, int b)         {             if (p < 0 || p > model.homecarouselitems.count - 1) return;             var filepath = //filepath              if (file.exists(filepath) && !utils.isfilelocked(new fileinfo(filepath)))             {                 bitmapimage bitmapimage = new bitmapimage();             bitmapimage.begininit();             bitmapimage.urisource = new uri(filepath,urikind.absolute);             bitmapimage.endinit();             bitmapimage.freeze();                 switch (b)                 {                     case 1:                         leftimage.background = new imagebrush() { imagesource = bitmapimage };                          break;                     case 3:                         rightimage.background = new imagebrush() { imagesource = bitmapimage };                          break;                     case 2:                         center.content = new image() { source = bitmapimage };                          break;                 }             }           } 

can please take , me understand doing wrong here..

notifypropertychanged() works on properties.

i think image cannot found @ filepath, thats why won't see anything.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -