I'm just curious, it doesn't matter if I repeat a subpath to some property in each binding or bind a DataContext and specify only relative paths in the bindings.
Examples:
Absolute paths:
<UserControl x:Name="uc"/>
<StackPanel>
<TextBox Text="{Binding ViewModel.Prop1, ElementName=uc}" />
<TextBox Text="{Binding ViewModel.Prop2, ElementName=uc}" />
</StackPanel>
</UserControl/>
Relative paths:
<UserControl x:Name="uc"/>
<StackPanel DataContext="{Binding ViewModel, ElementName=uc}">
<TextBox Text="{Binding Prop1}" />
<TextBox Text="{Binding Prop2}" />
</StackPanel>
</UserControl/>
I know that both bind the same properties, but I'm interested in what really happens behind the scenes, because maybe this can affect performance in situations where there are more than 2 bindings. Will the absolute path option have more “event traffic” because each of the text bindings observes the ViewModel property and its specific property? Or will it be exactly the same? I could imagine that the BindingManager resolves all binding paths, c. both options end in exactly the same IL.
:
- ( ) "" ?