Hi,
Can anyone help me please, I am trying to add some images to my application but this is the first time I have used WPF and am a little lost.
I have some JPEG images that I have loaded into my application as resources so that I don't have to point to file paths in my code anywhere.
I then have an array list of objects, all of which are objects that I have created. Each object as a variable called oLocation which points to the relevant picture in the resources list.
I want the program to display a certain image when it loads up but then this image will change on the press of a button.
I have looked everywhere but whatever I try doesn't seem to work, I have looked at using the image element but when I set the source to the oLocation variable it get this erroer "Unable to cast object of type 'System.Drawing.Bitmap' to type 'System.Windows.Media.Imaging.BitmapImage'."
here is how I am trying to do it
Dim ib As New BitmapImage
ib.BeginInit()
ib = QuestionList(iCounter).Location()
ib.EndInit()
Image1.Source = ib
This is where I have pointed to the resource in the program
GQ = New GifQuestion(My.Resources.Resource1.resource1, "Has Been", "Added")
GifQuestion is my own class and resource1 is an image in the resource list and "Has Been" & "Added" are just two strings to fill space as I have been testing using the output window.
GQ is contained within the QuestionList() array list.
Can anyone pointme in the right direction please, I am very confused by this.
Thanks in Advance
Dave