i use microsoft visual studio 2010
this project goal to make a Matching game picture
this is code from UI
this is from class
This class i want to make prosedure(void) event click, in this void if i click a stackpanel i will get a ID_GAME, and then i click another stackpanel to compare the ID_GAME, if ID_GAME is match, it will be continue the game.
private void stackpanel_Tap_1(object sender, GestureEventArgs e)
{
StackPanel firstklk = null;
StackPanel scndklk = null;
//Button btn = (Button)sender;
StackPanel Stn = (StackPanel)sender;
if (Stn != null)
{
if (firstklk == null)
{
Stn.Tag = this.Tag;
firstklk.Tag = Stn.Tag;
return;
}
scndklk.Tag= Stn.Tag;
if (firstklk.DataContext == scndklk.DataContext)
{
MessageBox.Show("MATCH");
}
}
else
{
MessageBox.Show(" Not Match ");
}
//MessageBox.Show("Succes");
}
If You have another way to compare a value from database (web service), you can tell me the code?
Akhil GargPosted Jan 19, 2015, 2:29 PM
You are trying to access tag property of stack panel instead of try this tag
object tag=((sender as StackPanel).Children[0] as Image).Tag;