What is the difference between the following TargetType specifications?
1.
<Style TargetType="{x:Type Button}" ...
2.
<Style TargetType="Button" ...
It seems the both works fine.
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.
In the first example, the
Typemarkup extension creates an instance ofTypespecified by the given string, i.e.Button.In the second example, the type converter associated with the
TargetTypeproperty converts the string"Button"into the requiredType.Both give exactly the same result. Notably, in Silverlight the
Typemarkup extension does not exist so (2) is only possible.