持有事件Longlistselector [英] Hold Event Longlistselector

查看:202
本文介绍了持有事件Longlistselector的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HEJ

我要创建一个标准的holdevent。当你持有一个元素,总会出现,你可以选择像一个新的列表一些选项。

I want to create a standard holdevent. When you hold an element, there would appear some options you could chose like a new list.

你如何创建它,它只是简单地用一个弹出完成或还有一个更聪明的方式?

How do you create this, is it just simply done with a popup or is there a smarter way?

额外

找到答案后,看到答案下面,一些不错的信息是:

After finding the answer, see answer below, some nice info is:

将固定事件中的上下文创建。
然后你可以根据不同的项目更改到不同的contextmenus。你可以得到一个由以下

Put the context creation inside the hold event. Then you can change to different contextmenus depending on the item. You can get the item that was holded by the following

    private void StackPanel_Hold(object sender, GestureEventArgs e)
    {
        ItemViewModel itemViewModel = (sender as StackPanel).DataContext as ItemViewModel;
        string t = itemViewModel.LineOne;
    }

    <ListBox x:Name="MainListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}" >
<ListBox.ItemTemplate>
    <DataTemplate>
        <StackPanel Margin="0,0,0,17" Height="78" Hold="StackPanel_Hold">
            <TextBlock Text="{Binding LineOne}" />
            <TextBlock Text="{Binding LineTwo}" />
        </StackPanel>
    </DataTemplate>
</ListBox.ItemTemplate>



一个很好的链接,便于实施也低于Youtube链接,在这里复制:
的Youtube

A good link for easy implementation is also youtube link below, replicated here : Youtube

推荐答案

一个文本菜单的一个选项。

A ContextMenu is one option..

http://blogs.msdn.com/b/msgulfcommunity/archive/2013/05/19/windows-phone-toolkit-context-menu-getting-selected-item-within-a-long-list-selector的.aspx

这篇关于持有事件Longlistselector的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆