In WPF, what are the differences between the x:Name and Name attributes?

前端 未结 15 1549
闹比i
闹比i 2020-11-22 05:19

The title says it all. Sometimes it seems that the Name and x:Name attributes are interchangeable.

So, what are the definitive differences

15条回答
  •  野性不改
    2020-11-22 05:40

    My research is x:Name as global variable. However, Name as local variable. Does that mean x:Name you can call it anywhere in your XAML file but Name is not.
    Example:

    
    
    

    You can't Binding property Content of Button with Name is "btn" because it outside StackPanel

提交回复
热议问题