开发者

what does means Binding with no source property in silverlight?

开发者 https://www.devze.com 2023-04-08 19:14 出处:网络
I am little new and I have a doubt in relation with databinding. To bind something I usually use {binding propertyName,...} but in some post/blogs I can see the kind of code like ItemsSource=\"{Bindi

I am little new and I have a doubt in relation with databinding.

To bind something I usually use {binding propertyName,...} but in some post/blogs I can see the kind of code like ItemsSource="{Binding}". Why not use ItemsSource="{Binding YourCollection}"?

W开发者_JS百科hat are the differences?

Thank you! :=)


Some times the current DataContext is the collection that supplies the items for some ItemsControl like a ListBox. In which case there is no property to bind to, the source object as a whole is the value to be assigned to the ItemsSource property. That's what ItemsSource="{Binding}" means. When no property path is specified the binding's Source object is passed in.

Whereas ItemsSource="{Binding YourCollection}" means find the property called YourCollection on the Source object and pass its value to ItemsSource.

0

精彩评论

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