I have a xaml text block defined like this:
<TextBlock HorizontalAlignment="Left" Margin="307,43,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="105" Width="230" Text="{Binding Supplier}"/> I'm trying to bind to the property Supplier.
My constructor for the Xaml window code-behind class:
InitializeComponent(); viewModel = new NewOrderViewModel(); DataContext = viewModel; There I explicitly set DataContext to be my viewModel object, which contains Supplier property.
And my viewModel prop:
public SupplierDto Supplier { get { return supplier; } set { supplier = value; } } Isn't this all I have to do (set DataContext to an appropriate object), and have all public properties available for binding as I see fit?