TheSwamp
Code Red => .NET => Topic started by: djee on January 23, 2017, 02:59:42 PM
-
I'm trying to use an image from my resources (Embedded in .resx) for one of my WPF button. Nothing is working... I can see the image in my designer but not when executing... The image resource is of type Bitmap. I've tried lots of different scenario & can't get anything going. Anybody has experience using images from resources? :crazy2:
NOT working:
Dim myAssembly As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
Dim myStream As Stream = myAssembly.GetManifestResourceStream("FreezeOn.png")
Dim image As New Bitmap(myStream)
my XAML
<Button Name="ScanFile">
<StackPanel>
<Image Name="myExitImage" Source="pack://siteoforigin:,,,/Resources/FreezeOn.png"/>
</StackPanel>
</Button>
-
I don't have many images saved as resources, but I did find this one.
-
Is the persistence setting of your image set to: Embedded in .resx? I`m guessing everything is fine on your side of thing (you can see the image)? If you copy your app to another directory, do you still see the resource image ?
-
Is the persistence setting of your image set to: Embedded in .resx? I`m guessing everything is fine on your side of thing (you can see the image)? If you copy your app to another directory, do you still see the resource image ?
It's not listed in the .resx file, just set as Resource for the build action.
-
I`m guessing everything is fine on your side of thing (you can see the image)? If you copy your app to another directory, do you still see the resource image ?
Sorry, yes and yes.
-
Thanks to the image you've posted, I just saw the BUILD ACTION comboBox menu... As you've mention, I just changed the build action to ''Ressource'' & all is fine... I won't tell you how much time I lost trying to figure this one out... :whistling:
Thanks a bunch!