Jonathan Allen
Jonathan Allen

Reputation: 70287

WPF: Binding and Commands

My Customer has a property called SaveCommand.

My form is data-bound to an instance of the Customer object.

Using XAML, how would I bind Customer.SaveCommand to the form's save button?

Upvotes: 0

Views: 66

Answers (1)

bufferz
bufferz

Reputation: 3476

Assuming the form's DataContext has been set to the customer object

<Button Content="Save Button" Command="{Binding SaveCommand}" />

or perhaps

<Button Content="Save Button" Command="{Binding SelectedCustomer.SaveCommand}" />

Upvotes: 2

Related Questions