View
<ListBox x:Name="listCard" FontSize="20" ItemsSource="{Binding Cards}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ListBox.ItemTemplate>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding SelectionChangedCmd}" CommandParameter="{Binding ElementName=listCard}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ListBox>
VM
DelegateCommand<ListBox> _SelectionChangedCmd = null;
public DelegateCommand<ListBox> SelectionChangedCmd
{
get
{
if (_SelectionChangedCmd == null)
{
_SelectionChangedCmd = new DelegateCommand<ListBox>(SelectionChanged);
}
return _SelectionChangedCmd;
}
}
void SelectionChanged(ListBox listCard)
{
Card = listCard.SelectedItem as Card;
}