Q:

Count Points from Images on a Grid

I am adding images to a grid in the code below. I need to be able to say, if molePopUp is being shown on the grid add one to an integer, so I can keep score of all the times the image is correctly pressed. Any Help?
// Change Image from "Hut" to Mole \\
private void ChangeImage()
{
    Image molePopup = MoleImage();
    int numCol = Convert.ToInt32(NumberOfColumns);
    //Random Number - Col
    Random randomColumns = new Random();
    int ranCol = randomColumns.Next(1, numCol);
    //Random Number - Row
    Random randomRow = new Random();
    int ranRow = randomRow.Next(1, NumberofRows);
    string Moleimage = TUtils.GetIniFileString(Moleini, "ImagePath", "PictureFile", Root + "mole2.png");
    //Populate Grid with Mole at Random Times \\
    Grid.SetRow(molePopup, ranRow);
    Grid.SetColumn(molePopup, ranCol);
    grid_Main.Children.Add(molePopup);
}

A:

handle the MouseUp event directly on your mole image. add this somewhere in your ChangeImage Method:
molePopup.MouseUp += new MouseButtonEventHandler((o, e) => 
{
    // check here with "e" if the left button has been pressed
});

Better: Create a new ControlTemplate for System.Windows.Constrols.Button in a xaml ResourceDictionary which simulates the look of the Image Control (rectangular, no round corners). You also can add Triggers to get some visual effects on mouse over and click.
Create a new Instance of the Button Control in your ChangeImage Method and assign the ControlTemplate.
Now capture the Click event with .Click += new RoutedEventHandler(...) instead.

