Refresh Image - C# WPF -



Refresh Image - C# WPF -

good evening: have listview contains areas of place (code , description) when cross it, fields textbox, checkbox , image, "binding" perfectly. when edit , record without touching image, works perfectly. problem in when load new image , record, records (areas) show same image. problem lone on having showed because when go out , come in application values of fields image (sql) not alter.

my code:

xaml:

<image x:name="imgfoto" source="{binding foto}" stretch="fill" horizontalalignment="left" height="181" margin="243,371,0,0" verticalalignment="top" width="250" grid.columnspan="2"/>

c#:

load image (foto):

private void btncargarfoto_click(object sender, routedeventargs e) { openfiledialog od = new openfiledialog(); od.filter = "jpg(*.jpg)|*.jpg|png(*.png)|*.png|gif(*.gif)|*.gif|bmp(*.bmp)|*.bmp|all files(*.*)|*.*"; if (od.showdialog() == true) { using (stream stream = od.openfile()) { bitcoder = bitmapdecoder.create(stream, bitmapcreateoptions.preservepixelformat, bitmapcacheoption.onload); imgfoto.source = bitcoder.frames[0]; } system.io.filestream fs = new system.io.filestream(od.filename, system.io.filemode.open); foto = new byte[convert.toint32(fs.length.tostring())]; fs.read(foto, 0, foto.length); } }

the load works perfectly. happening?????? give thanks much.

reading between lines think problem overriding imgfoto's source databinding when explicitly set source in btncargarfoto_click. instead of setting imgfoto.source bitcoder.frames[0] should set foto property on object imgfoto bound to.

c#

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -