I have this sample code:
<ControlTemplate Content="{Binding .}"/>
What does the point mean here relating to the binding?
I have this sample code:
<ControlTemplate Content="{Binding .}"/>
What does the point mean here relating to the binding?
The .
(period) of the binding refers to the binding path, and simply tells it to bind to the current source (i.e. inherited DataContext).
From the MSDN page:
Optionally, a period (.) path can be used to bind to the current source. For example, Text=”{Binding}” is equivalent to Text=”{Binding Path=.}”.
Also note that Path=
can be omitted if Path is the first parameter, so your code means exactly the same. I tend to prefer just the {Binding}
syntax, though it's up to you.