WPF ListViewItem Commands with MVVM pattern

If you're interested to see how to attach commands to listview items for use with an implementation of the MVVM pattern, have a look at this.



<Style x:Key="Local_OpenEntityStyle"
           TargetType="{x:Type ListViewItem}">
        <Setter Property="acb:CommandBehavior.Event"
                        Value="MouseDoubleClick" />
        <Setter Property="acb:CommandBehavior.Command"
                        Value="{Binding ElementName=uiEntityListDisplay, Path=DataContext.OpenEntityCommand}" />
        <Setter Property="acb:CommandBehavior.CommandParameter"
                        Value="{Binding}" />



Here the command to be fired on the MouseDoubleClick event is set, the CommandParameter, will be the data object that we click on.

Comments are closed