I have defined in XAML a list view, see following fragment:
<Grid>
<Button Content="_Generate List ..." Height="23" HorizontalAlignment="Right" Margin="0,0,12,12" Name="buttonGenerateLists"
VerticalAlignment="Bottom" Click="ButtonGenerateListsClick" Width="108" Grid.Column="1" />
<ListView HorizontalAlignment="Stretch" Margin="275,34,13,96" Name="listViewPatches" VerticalAlignment="Stretch" SelectionMode="Extended"
VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" AlternationCount="1" GotFocus="ListViewPatchGotFocus"
MouseDoubleClick="{Binding Path=EditSelectedItemCommand}" SelectedItem="{Binding IsSelected}">
And I get the following compile error:
Error 1 MouseDoubleClick="{Binding Path=EditSelectedItemCommand}" is not valid. '{Binding Path=EditSelectedItemCommand}' is not a valid event handler method name. Only instance methods on the generated or code-behind class are valid. Line 12 Position 19. G:\Data\Eigen\Informatica\KorgKronosTools\KorgKronosTools\PcgWindow.xaml 12 19 PcgTools
(note: line 12 is the last line in the fragment above).
I guess I did not set the data context right, however in my code behind the following fragment is coded:
public PcgWindow(MainWindow mainWindow, string pcgFileName, PcgMemory pcgMemory)
{
InitializeComponent();
_mainWindow = mainWindow;
_viewModel = new PcgViewModel(mainWindow.ViewModel);
...
DataContext = _viewModel;
And I defined the binding itself in the viewmodel:
ICommand _editSelectedItemCommand;
public ICommand EditSelectedItemCommand
{
get
{
return _editSelectedItemCommand ?? (_editSelectedItemCommand = new RelayCommand(param => EditSelectedItem(),
param => CanExecuteEditSelectedItem()));
}
}
Can someone help me to fix the compile error?
Thanks in advance.