Im developing a card app. The app shall show two random cards on a table.
Ive created and image card deck to show the specific cards on the screen. Each card is an individual jpg file. The jpg files are all in a "Images" directory, which was created in the project directory.
The application starts with 2 default card images.
During the card drawing process, the new two images shall be seen.
To change the picture of the card1, I tried this:
string card1_url = "/Ah.jpg"; // Default value
// Image-Path for new cards
if (card1.ToString() == "Ah") { card1_url = "Images/Ah.jpg"; }
if (card1.ToString() == "Kh") { card1_url = "Images/Kh.jpg"; }
...
Image card1_image = (Image)this.FindName("Card1_img");
Uri card1Uri = new Uri(card1_url, UriKind.Relative);
BitmapImage newImage = new BitmapImage(card1Uri);
card1_image.Source = newImage;
The application starts with no errors, but I see no card picture after dealing.
The URI looks correct.
How can I make sure, that the URI is correct? Is something missing? How can I fix it?