Note that there are some explanatory texts on larger screens.

plurals
  1. POWin8 ListView Tap does not select item
    text
    copied!<p>Hi so I'm doing a note taking app and Ive got it connected to my SQL Azure Database. The items get automatically populated through MobileServiceCollectionView. After tapping an item, a detailView should be opened to the right...</p> <p>I dont know why but tapping an item does not select it, so I cant check for listView.SelectedItem in the noteListView_Tapped event.....</p> <p>What is wrong with my listview?</p> <pre><code>&lt;ListView x:Name="noteListView" Margin="20,0,0,0" Tapped="noteListView_Tapped"&gt; &lt;ListView.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal" Margin="2"&gt; &lt;CheckBox x:Name="CheckBoxComplete" IsChecked="{Binding Complete, Mode=TwoWay}" Checked="CheckBoxComplete_Checked" Padding="3"/&gt; &lt;TextBlock x:Name="TextBlockTodoItem" Text="{Binding Title}" Padding="3" /&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/ListView.ItemTemplate&gt; &lt;/ListView&gt; </code></pre> <p>And here the Tapped event.. It crashed on <code>TodoItem t = (TodoItem)lv.SelectedItem;</code></p> <p>So i added the if condition and now nothing happens except for the debug prints.</p> <pre><code>private void noteListView_Tapped(object sender, TappedRoutedEventArgs e) { Debug.WriteLine("0"); ListView lv = (ListView)sender; if (lv.Items.Count &gt; 0) { if (lv.SelectedItems.Count &gt; 0) { TodoItem t = (TodoItem)lv.SelectedItem; Debug.WriteLine("1"); Debug.WriteLine(t.Title); try { Location l = TodoItem.StringToLocation(t.LocationTaken); Debug.WriteLine("2"); MapLayer.SetPosition(locationIcon, l); map.SetView(l, 15.0f); } catch (Exception ex) { Debug.WriteLine("Map set position failed.: " + ex.Message); } } } } </code></pre> <p>So what do I have to change or how do I know which item has been clicked/selected?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload