Hi. In a WPF app, what XAML code do I need to do the same job as this line of c#:
this.DataContext = this;
? Thanks
Hi. In a WPF app, what XAML code do I need to do the same job as this line of c#:
this.DataContext = this;
? Thanks
<UserControl.DataContext>
<Binding Path="ViewModel"></Binding>
</UserControl.DataContext>
ViewModel is a public property in your code behind.
I think you could do:
DataContext="{Binding RelativeSource={x:Static RelativeSource.Self}}"
I've just tried it, and it seems to work...