Is there any difference in x:name and name for controls in xaml file?

后端 未结 3 894
余生分开走
余生分开走 2020-12-03 23:02

I am new in Silverlight.
When I add some control to my xaml file with Visual Studio it set controls name with Name property, but there is also x:Name.
Is there any d

3条回答
  •  死守一世寂寞
    2020-12-03 23:39

    No, you just can't use them both. x:Name is what the XAML preprocessor actually uses and Name is just a convience property provided on the FrameworkElement class to set it.

    From the MSDN reference:

    If Name is available as a property on an element, Name and x:Name can be used interchangeably, but an error results if both attributes are specified on the same element.

提交回复
热议问题