Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try changing your command binding to the following code. Listbox item is a visual child of listbox and you need to get your datacontext wired up correctly. I think. Note the Window Type. Change that to whatever your top level datacontext is where the command is declared and the listbox exists. Ie: usercontrol, window, etc...</p> <pre><code>&lt;MouseBinding Gesture="LeftDoubleClick" Command="{Binding DataQuerySortEdit, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}}" /&gt; </code></pre> <p>You might be able to debug this my looking at your output window when you run your app, it will show you binding errors like this.</p> <h2>EDIT 1: Mvvm Light Event to Command</h2> <p>Okay, I totally overlooked the fact that you are suing Mvvm Light. MVVM-Light has a function built in for binding events to commands on your view model.</p> <p>Add the following to your windows namespaces:</p> <pre><code>xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:cmd="http://www.galasoft.ch/mvvmlight" </code></pre> <p>Now change your border inside your listbox item to include the following:</p> <pre><code>&lt;Border ...&gt; &lt;i:Interaction.Triggers&gt; &lt;i:EventTrigger EventName="LeftDoubleClick"&gt; &lt;cmd:EventToCommand Command="{Binding DataContext.DataQuerySortEdit, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/&gt; &lt;/i:EventTrigger&gt; &lt;/i:Interaction.Triggers&gt; &lt;/Border&gt; </code></pre> <p>Mvvm light has built this in order to facilitate exactly what you are looking for. It lets you take any event and bind a command to it. I use this for form validation through the lostfocus events of controls etc. </p> <p>Make sure you have the following references in your project:</p> <ul> <li>GalaSoft.MvvmLight.WPF45</li> <li>GalaSoft.MvvmLight.Extras.WPF45</li> <li>Microsoft.Expression.Interactions</li> </ul> <p>Hope this helps</p> <h2>EDIT 3:</h2> <p>Just a last ditch effort, what if you use the following: </p> <p>It adds the Datacontext to the command name.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload