开发者

Silverlight: Not naming controls in XAML when using MVVM (Silverlight)?

开发者 https://www.devze.com 2023-02-16 22:21 出处:网络
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?

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消