I am trying to emulate the behavior of a ListView like the Messaging app in Windows Phone 8.1 but I can't seem to get the hang of it.
My XAML so far is:
<ListView ItemsSource="{Binding}"
ItemTemplate="{StaticResource dataTemplate}"
Name="characterListView"
SelectionChanged="CharacterListView_OnSelectionChanged"
SelectionMode="Multiple"
ItemClick="CharacterListView_OnItemClick"
IsItemClickEnabled="False">
</ListView>
And the code behind is:
private void CharacterListView_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (characterListView.SelectedItems.Count > 0)
{
characterListView.SelectionMode = ListViewSelectionMode.Multiple;
}
else
{
//characterListView.ItemClick -= CharacterListView_OnItemClick;
characterListView.SelectionMode = ListViewSelectionMode.Single;
}
}
private void CharacterListView_OnItemClick(object sender, ItemClickEventArgs e)
{
Frame.Navigate(typeof (PivotPage), e.ClickedItem);
}
The idea is, basically: if no items are selected, navigate to a page using the clicked item as parameter. Tapping at the left of the item should activate multiselect, and disable navigation. (I have another plans for multiselection, on the appbar, but that's another story). Well... Just like the messaging app!
I am aware of this component: https://modernography.wordpress.com/2014/08/28/multiselectlistview_with_edge_action/ which is nice, but I can't get it to work exactly anyway. I've fiddled with this for a couple of weeks and nada.