As DHN says, your command execution methods DeleteBookExecute()
, CanDeleteBookExecute()
should have a parameter of type object.
You're ideas are pointing in the right direction. Try this:
<DataGrid Name="LibraryGrid"
Height="250"
ItemsSource="{Binding Books}"
AutoGenerateColumns="False" >
and
Command="{Binding DataContext.DeleteBook, ElementName=LibraryGrid}" CommandParameter="{Binding}"
The use of ElementName
with the DataContext.DeleteBook
gets you the Command of the LibraryViewModel.