user604613
user604613

Reputation:

ListView Item Selection Windows Store

I want a ListView to behave like this:

With mouse Input:

With touch Input:

I have played around with various of the events and settings but cant seem to get it to work right.

Upvotes: 1

Views: 2835

Answers (2)

chue x
chue x

Reputation: 18803

In other words, you want your listview to behave like the Windows Start screen? This one was brutal for me to figure out - the mouse part was easy, but the touch part not so much. The solution turns out to be pretty easy. You just have to enable the right options for your listview. Here's the xaml for mine:

<ListView
        x:Name="itemListView"
        SelectionMode="Extended"
        IsSwipeEnabled="True"
        IsItemClickEnabled="True"
        ItemClick="ItemView_ItemClick"
        />

Sorry, I haven't figured how to get code to highlight in StackOverflow yet.

Upvotes: 2

Matthias
Matthias

Reputation: 164

This could help you with the mouseclicks

 private void MainForm_MouseDown(object sender, MouseEventArgs e)
    {
        if (e.Button == MouseButtons.Left)
            method()
        if (e.Button == MouseButtons.Right)
            set selection = false
            method()
    }

and for the handle of the touch i hope this helps

http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465387.aspx

Upvotes: 1

Related Questions