I'm trying to visually present a card on a WPF application. The cards are objects which hold two Enums: (1) _suit and (2) _value. I want that every time a card is drawn from the pile an Image element (called player1curCardSuit) in my XAML will change it's source to a corresponding card._value.
I'm trying to use Window.Resources for this. This is what I have in my XAML:
<Window.Resources>
<Image x:Key="heart" Source="/images/heart.jpg" Height="50" Width="50" />
<Image x:Key="club" Source="/images/club.jpg" Height="50" Width="50" />
<Image x:Key="diamond" Source="/images/diamond.jpg" Height="50" Width="50" />
<Image x:Key="spade" Source="/images/spade.jpg" Height="50" Width="50"/>
</Window.Resources>
and this is what I have in my VB code:
player1curCardSuit.Source = FindResource(player1.getCurCard.getSuit)
getSuit returns an object called _suit (an Enum member) of a the current card. When I run the program and draw a card I get an error:
'System.Windows.ResourceReferenceKeyNotFoundException' occurred in PresentationFramework.dll Additional information: 'spade' resource not found.
*'spade' is the Enum value I got from getSuit.