C
C#2y ago
Indeed

❔ WPF export binding into resources

Hi! How can I define a binding with the ability to use intellisense
<UserControl.Resources>
<Binding x:Key="SelfContext">
<Binding.RelativeSource>
<RelativeSource AncestorType="{x:Type local:WeatherHomeView}" Mode="FindAncestor" />
</Binding.RelativeSource>
</Binding>
</UserControl.Resources>
<UserControl.Resources>
<Binding x:Key="SelfContext">
<Binding.RelativeSource>
<RelativeSource AncestorType="{x:Type local:WeatherHomeView}" Mode="FindAncestor" />
</Binding.RelativeSource>
</Binding>
</UserControl.Resources>
<Button DataContext="{StaticResource SelfContext}"/>
<Button DataContext="{StaticResource SelfContext}"/>
it does not provide autocomplete but
<Button DataContext="{Binding RelativeSource={RelativeSource AncestorType=local:WeatherHomeView}}"/>
<Button DataContext="{Binding RelativeSource={RelativeSource AncestorType=local:WeatherHomeView}}"/>
does
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.