Reputation: 4751
Is there a way to databind to a property in the codebehind of a wpf control, while having a different datacontext??
Upvotes: 0
Views: 132
Reputation: 22445
for every binding you can set the source explicitly. You can use StaticResource or RelativeSource to get where you want.
<TextBlock DataContext="{Binding MyDataContext}" Text="{Binding Source={StaticResource MyOtherDataContext} Path=PropertyFromOtherDataContext}" />
Upvotes: 2