Home WPF Using the user control or window as the view model (data context) for XAML Using the user control or window as the view model (data context) for XAML byAlex R. •December 11, 2022 To use a user control or windows code behind as the data context, add this to your XAML in a WPF application: <... DataContext="{Binding RelativeSource={RelativeSource Self}}" .../> Tags WPF Facebook X