image - accessing pictures in my exe of wpf app from codebehind -
im accessing image in xaml , setting picturebox with
source="/socialshock-wpf-client;component/images/blue-bar-replication.png"
how in codebehind?
public static bitmapimage getimagefromresource(string name) { var res = new bitmapimage(); res.begininit(); res.streamsource = assembly.getexecutingassembly().getmanifestresourcestream("socialshock-wpf-client.images." + name); res.endinit(); return res; }
invoke method image name, "blue-bar-replication.png" in case. image build action should set embededresource.
Comments
Post a Comment