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.

1
  • The same behavior give syntax like "{Binding .}" (short from "{Binding Path=.}"). May somebody can explain what the dot means? Commented Mar 23, 2010 at 18:41

4 Answers 4

7

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.

Sign up to request clarification or add additional context in comments.

Comments

3

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.

Comments

0

{Binding} is for {Binding [CurrentDataContext]}

Comments

0

{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, then it will walk up the VisualTree and find the closest Parent that has a DataContext.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.