在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
.