Can I enable PreviewClick using InputBindings in WPF?

Posted by No hay Problema on Stack Overflow See other posts from Stack Overflow or by No hay Problema
Published on 2010-04-07T08:22:53Z Indexed on 2010/04/07 20:23 UTC
Read the original article Hit count: 218

Filed under:
|
|

I want to detect when a user clicks on an item on a listview, without using events as I do command binding and I don't like all the nonsense of the behaviours. I have tried this:

<ListView x:Name="MainList" Margin="2,8,6,8" Background="Black" ItemsSource="{Binding Path=AssetsVM.Data, Mode=OneWay}" BorderBrush="{x:Null}" >

    <ListView.InputBindings>
         <MouseBinding Command="{Binding Path=AssetsVM.SelectActivo}" CommandParameter="{Binding ElementName=MainList, Path=SelectedItem}" MouseAction="LeftClick" />
    </ListView.InputBindings>

This works fine if I click on the listview but does not work on the items, what I need is either a way to enable "Preview" or have a MouseAction/Gesture that behaves as preview, is it possible?

Thanks

© Stack Overflow or respective owner

Related posts about wpf

Related posts about inputbinding