I have a ListBox that is bound to an ObservableCollection
of Customers. The XAML code for this is:
<ListBox x:Name="lb_Customers" Height="683" ItemsSource="{Binding Path=Customers, UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<Label Margin="0,0,0,0" Padding="0,0,0,0" Content="{Binding Name}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
This points over to some code in my MainViewModel
class:
public ObservableCollection<Customer> Customers
{
get { return _customers; }
set
{
Set("Customers", ref _customers, value);
this.RaisePropertyChanged("Customers");
}
}
When I select a customer in this listbox, I'd like to execute some code that goes and compiles the customer's order history.
However, I have no idea how to do this using DataBinding/CommandBinding.
My question: where do I even begin?