Alexander Ciesielski
Alexander Ciesielski

Reputation: 10834

ListView rightclick selects item, left-click does not

Im writing a windows 8 note-taking app and Ive got a Listview hooked up to a SQL database from Azure and a ListViewItem Template with a stackpanel and inside a checkbox plus some text..

When i left click or tap an item, it does not get selected, but rightclicking does. How can i get it to select the listview item by leftclicking?

<ListView x:Name="noteListView" Margin="20,0,0,0" IsItemClickEnabled="True" ItemClick="noteListView_ItemClick" >

Upvotes: 2

Views: 1120

Answers (1)

chue x
chue x

Reputation: 18803

Two things:

  1. You have to set IsItemClickEnabled to False
  2. You have to handle the SelectionChanged event and not the click event

Xaml:

<ListView x:Name="noteListView" Margin="20,0,0,0" 
IsItemClickEnabled="False" SelectionChanged="noteListView_SelectionChanged">

Upvotes: 2

Related Questions