Thursday 15 March 2012

c# - WPF Adding images to canvas without them being added as resources -



c# - WPF Adding images to canvas without them being added as resources -

i trying add together images wpf application canvas. understand, need referenced resource in vs solution. however, need able re-create image folder, , xml file relative uri of image parsed, , image loaded canvas :

image image = new image(); var pic = new bitmapimage(); pic.begininit(); pic.urisource = new uri(url, urikind.relative); // url xml pic.endinit(); image.source = pic; layoutroot.children.add(image); //since image not in vs marked resource, // nil shows

thank kind advices

if specify total path uri instead of using urikind.relative uri, work properly:

pic.begininit(); pic.urisource = new uri(@"c:\path\to\file.jpg"); pic.endinit();

c# .net wpf canvas

No comments:

Post a Comment