I'm new with XAML/WPF and I don't know how to deal with this issue, I spend too much time into this, but I can't figure it out.
I have a class called Card with a property which "should" contain a source of an image.
public class Card
{
public ImageSource image; // this is the only one which doesn't get a value..
}
I also have a class with a method which add information to the Collection of card like this:
public class deck
{
public card[] = new card[51];
public void FillCards()
{
while(I > something) //don't mind about the loop, because it's working fine
{
card[i] = new card()
{
name = this.name, //works
number = this.number, //works
//works etc...
image = new BitmapImage(new Uri(path, UriKind.Absolute)), //except this is not working
//Before you ask, yes the path is correct...
};
}
}
}
So in short, my question is:
Why can't I store BitmapImage in the ImageSource property,
What I'm basically doing is this: How can I have a property in a class to store an picture/image?
But I'm getting NullReferenceException.
Sorry for the bad English...