views:

182

answers:

4

I've seen this syntax show up, and have tried to google for it's definition to no avail; what does it mean when a dp is bound this way?

<Grid>
    <ContentControl Content="{Binding}"/>
</Grid>

I was under the assumption that you have to bind to some property on the DataContext, or another element, but this appears to bind to nothing.

+2  A: 

I believe it means you are binding to the root of whatever the binding context is. So if you use this syntax in a datatemplate that is part of some sort of list control, you would be binding to the root level of whatever the parent control (the list control) was binding to.

Phil Sandler
+2  A: 

I believe {Binding} refers to the DataContext itself.

edit (clarification): By DataContext I mean the current level DataContext. For example, if your window's DataContext is bound to a List, then setting ItemsSource on a ListBox control in your window to {Binding} would bind the ListBox to the List itself, not a property of the List, like Count.

Jeremy Bell
A: 

{Binding} is for {Binding [CurrentDataContext]}

Jobi Joy
A: 

{Binding} means that you want to Bind to the the current DataContext which could be set on the object itself. If no DataContext is set on the current object, the it will walk up the VisualTree and find the closest Parent that has a DataContext.

Metro Smurf