Can anyone confirm if I am using MVVM (2 way binding) then I don't need to name my controls in XAML as I won't be accessing them via code behind but will be updating them by Binding?
This was the case with WPF but un开发者_StackOverflow社区sure whether Silverlight allows a control without x:Name
?
You don't have to name your controls to use binding. But you still can name them to aid in some UI scenarios (animations, drag&drop, etc).
You don't need them for View-ViewModel connection. However, names are needed i.e. when binding to other XAML elements (using Binding ElementName=nameOfControl, Path=propertyOfControl
).
精彩评论