0

Do you know is it possible to get element on MouseOver from ListView in WPF using XAML? I would like to bind mouse over element to command parameter.

What should I type in Path ?

<i:Interaction.Triggers>
    <i:EventTrigger EventName="MouseEnter">
        <i:InvokeCommandAction Command="{Binding SetOnMousePlayerCommand}"
         CommandParameter="{Binding ElementName=leftPlayersListViewGame, Path=XXX}"/>
    </i:EventTrigger>
</i:Interaction.Triggers>

Probably I have to do it in another way ? Could you tell my how ?

Dinesh Kumar P
  • 1,128
  • 2
  • 18
  • 32

1 Answers1

0

if you are looking to access the Event Args here how you should proceed:

<i:Interaction.Triggers>
 <i:EventTrigger EventName="MouseEnter">
    <command:EventToCommand Command="{Binding Mode=OneWay,Path=MouseEnterCommand}" PassEventArgsToCommand="True"/>
 </i:EventTrigger>
</i:Interaction.Triggers>

private RelayCommand<MouseEventArgs> _mouseEnterCommand;
public RelayCommand<MouseEventArgs> MouseEnterCommand
{
    get
    {
        return _mouseEnterCommand
            ?? (_mouseEnterCommand= new RelayCommand<MouseEventArgs>(
            (s) =>
            {
                //your logic 
            }));
    }
}

but if you are looking for the sender of the Event, so here is your answer Pal : Passing event args and sender to the RelayCommand

Community
  • 1
  • 1
SamTh3D3v
  • 9,854
  • 3
  • 31
  • 47