controlType"的TargetType =&QUOT之间的差异;和的TargetType =" {X:类型controlType}" [英] Difference between TargetType="controlType" and TargetType="{x:Type controlType}"

查看:219
本文介绍了controlType"的TargetType =&QUOT之间的差异;和的TargetType =" {X:类型controlType}"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WPF您可以设置的TargetType 的类型的名称或可以将其设置为 {X:类型nameOfType}

In WPF you can set the TargetType to either the name of the type or you can set it to {x:Type nameOfType}.

有谁知道有什么区别?

推荐答案

什么也没有。由于属性类型是键入的XAML分析器知道要尝试转换任何你提供给一个键入。在其他情况下,属性类型可能不太具体(如对象),而这也正是你所需要的标记扩展,否则XAML分析器将跨preT你的价值作为一个字符串

Nothing. Since the property type is Type, the XAML parser knows to try and convert whatever you supply to a Type. In other scenarios, the property type might be less specific (eg. Object), and that's where you need the markup extension, otherwise the XAML parser will just interpret your value as a String.

这篇关于controlType"的TargetType =&QUOT之间的差异;和的TargetType =" {X:类型controlType}"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆