【发布时间】:2011-05-13 17:45:06
【问题描述】:
可能重复:
In WPF, what are the differences between the x:Name and Name attributes?
为什么 WPF 有 x:Name 和 Name XAML? x:Name 有什么关系?
【问题讨论】:
可能重复:
In WPF, what are the differences between the x:Name and Name attributes?
为什么 WPF 有 x:Name 和 Name XAML? x:Name 有什么关系?
【问题讨论】:
长话短说:x:Name 是一个附加属性,因此可以设置在所有内容上。 Name 不是附加属性,因此仅在公开 Name 属性的事物上可用。 WPF 将 Name 别名为 x:Name,因此您始终可以安全地使用 x:Name,这是推荐的,因为您可以在任何地方使用它。
【讨论】: