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}"?
What are the differences?
Thank you! :=)
Some times the current
DataContextis the collection that supplies the items for some ItemsControl like aListBox. In which case there is no property to bind to, the source object as a whole is the value to be assigned to theItemsSourceproperty. That’s whatItemsSource="{Binding}"means. When no property path is specified the binding’sSourceobject is passed in.Whereas
ItemsSource="{Binding YourCollection}"means find the property calledYourCollectionon theSourceobject and pass its value toItemsSource.