Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7493029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:42:33+00:00 2026-05-29T16:42:33+00:00

I have defined in XAML a list view, see following fragment: <Grid> <Button Content=_Generate

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:42:42+00:00Added an answer on May 29, 2026 at 4:42 pm

    You cannot bind events, only commands, you would need to specify a method name which is defined in code-behind as the error notes.

    e.g.

    MouseDoubleClick="OnMouseDoubleClick"
    
    private void OnMouseDoubleClick(object sender, RoutedEventArgs e)
    {
        // Do something
    }
    

    If you must use a command you can use certain libraries like Interactivity (from the Blend SDK) which allow you to execute a command when an event is fired. e.g.

    <ListView ...>
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="MouseDoubleClick">
                <i:InvokeCommandAction Command="{Binding EditSelectedItemCommand}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </ListView>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a listbox defined in XAML as: <ListBox x:Name=directoryList MinHeight=100 Grid.Row=0 ItemsSource={Binding Path=SelectedDirectories}/>
I have a xaml grid defined as: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="150"/> <ColumnDefinition/> </Grid.ColumnDefinitions> </Grid>
I have the next problem. I have a ItemsControl defined with xaml. <Grid> <Grid.RowDefinitions>
i have an combox control defined with events in my mainpage.xaml <Grid x:Name=LayoutRoot> <ComboBox
I would like to bind a TreeView control I have defined in XAML to
If i have a storyboard animation defined in xaml resources, how do i go
I have defined a custom list template type for SharePoint . I install it
I have defined a config section in my app.config in the following way: <?xml
My situation is like following. I have a App.xaml which includes Style for ListView
I have several hundred brushes defined in Application.xaml. These are shared resources for several

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.