what is the difference between {binding} and {binding Account}?

mvvm-light, wpf

Solution

`{Binding}` will simply bind to the actual object set in the `DataContext`. `{Binding Account}` will bind to the Property `Account` on that object.

In your case if you had a `ViewModel` set against the root level `DataContext` then `Account` would be a property called `Account` on the `ViewModel`

Where you have

<HeaderedContentControl
            Content="{Binding}"
            ContentTemplate="{StaticResource CommandsTemplate}"/>

All this is doing is setting the `Content` of the `HeaderedContentControl` to the `ViewModel` provided you have something like this in the code behind of the `Window` or `UserControl`

 DataContext = yourViewModel;

Problem

here , i am confuse on {binding} and {binding Account}.when to use only simple {binding} and binding with proprty name in below code binding occur as :Content="{Binding}" ``` <Border Grid.Row="1" Grid.Column="0" Style="{StaticResource MainBorderStyle}" Background="{StaticResource ResourceListGradientBrush}" BorderThickness="0,0,1,1" Padding="0"> <StackPanel> <HeaderedContentControl Content="{Binding}" ContentTemplate="{StaticResource CommandsTemplate}"/> </StackPanel> </Border> ``` where is below code binding occur as ``` Text="{Binding Path=Name, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"/> ``` so i want to know use of them and difference of them.thank in advance.

Original source