Click here to Skip to main content
16,017,899 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

I have a silverlight app and i have two windows, first window is the parent and i have a few buttons in it, now two of them open the same window where i do a search, now for what i need is how can i know from the second window after the button click, how do i find out which button was pressed?

Thanks in advanced,
Ram.
Posted
Updated 3-Oct-11 0:04am
v2

1 solution

You can simply add the constructor for second window, in which you'll pass the parameter to identify clicked button, it could be a button.Tag property, or even the whole button object (but it would be not efficient way.
private Button_Click(object sender, RoutedEventArgs e)
{
  Button button = sender as Button;
  if(button!=null)
  {
   Window2 window = new Window2(button.Tag);
  }
  else
  {
    Window2 window = new Window2();
  }  
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900