John Threepwood
John Threepwood

Reputation: 16143

What does a single 'binding' mean in a XAML label?

The acceptecd answer here explains how a double click event can be realized for a TabItem.

I understand the approach except of one thing: <Label Content={Binding}>

What exactly does {Binding} mean here for the labels content?

Upvotes: 0

Views: 84

Answers (1)

dkozl
dkozl

Reputation: 33364

From Binding.Path

... period (.) path can be used to bind to the current source. For example, Text="{Binding}" is equivalent to Text="{Binding Path=.}"

which means it will bind whole object that is currently available in DataContext which then will be converted for display using default or custom template

EDIT

In this case TabItem hosts ContentPresenter with ContentSource set to Header which changes DataContext to whatever is currently available in Header therefore DataContext for Label will be set to string as defined in Header

enter image description here

Upvotes: 3

Related Questions