Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Showing a specific image after an event

$
0
0

Hi, I am trying to show an image following an event.  What I am doing is creating a mathematical quiz and when the Checkanswers event is raised if an answer is correct the image shown should be a tick and if incorrect a cross.

private bool CheckAnswers()
        {
            if (Val1 + Val2 == int.Parse(ans1.Text))
                return true;
            //Todo add code to display tick beside answer
            else
                return false;
            //Todo add code to display cross beside answer
        }

I have an image box created in the Xaml setup for the page at the end of the row beside the answer box (ans1) and tick.jpg and cross.jpg are both in my image files but how do I allocate the correct one to the empty image box?
<Image x:Name="isCorrect1" HorizontalAlignment="Left" Height="23" Margin="551,118,0,0" VerticalAlignment="Top" Width="24"/>


Nigel..


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>