Wpf listview disable selection but allow clicking

564 Views Asked by At

I have a simple listview bound to data with caliburn micro. When i click an item an event happens but othe item gets the blue selection and unable to click it again (without clicking elsewhere then on it again). How can i allow selecting the same item twice without having to select another item first?

Note: All other questions on SO seem to answer how to remove the blue highlight, but my issue is with the behaviour not the style

1

There are 1 best solutions below

0
Anu Viswan On BEST ANSWER

You could make use of MouseLeftButtonUp event. For example,

 <ListView ItemsSource="{Binding Data}" x:Name="MyListView" cal:Message.Attach="[Event MouseLeftButtonUp]=[Action OnClick($this)]"  />

And in View Model

 public void OnClick(object item)
 {
       if (item == null) return;
            // do something
 }