0
可能重复:
In WPF, what are the differences between the x:Name and Name attributes?为什么WPF有x:Name和Name XAML?
为什么WPF有X:名称和名称XAML? x:名称是什么?
可能重复:
In WPF, what are the differences between the x:Name and Name attributes?为什么WPF有x:Name和Name XAML?
为什么WPF有X:名称和名称XAML? x:名称是什么?
长话短说:x:名称是一个附加属性,因此可以在任何事物上设置。名称不是附加属性,因此只能用于公开名称属性的东西。 WPF别名名称为x:Name,因此您可以安全地始终使用x:Name,并且这是建议的,因为您可以在任何地方使用它。