I am new to Windows Phone 7.
I clicked one button and got:
private void button1_click(object sender, RoutedEventArgs e)
{
}
Is it possible get the tag property and object type of sender?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can get the Type by using the GetType() method:
If you want to cast it as a button, you can do this.
Using
asinstead of(Button)sendermeans that instead of an exception being thrown if it can’t be cast as a Button, it will simply return null. We can then check if it’s null and, if it’s not null, we can access its Tag property.