i'm developing windows phone app.i have image . xaml code:
<image x:name="imageclock" grid.row="1" source="image/myimage.png" height="240" width="240" />
and want change image.source code:
private void clickonbtn(object sender, eventargs e) { bitmapimage bm = new bitmapimage(new uri("image/darktheme.png", urikind.relativeorabsolute)); imageclock.source = bm; }
but when complied, imageclock.source=null , error:
an exception of type 'system.nullreferenceexception' occurred in newappver1.dll not handled in user code
your code looks ok maybe need add @
before image path handle /
in code behind :
bitmapimage bm = new bitmapimage(new uri(@"image/darktheme.png", urikind.relativeorabsolute));
Comments
Post a Comment