简体   繁体   English

上下文菜单未出现在Windows Phone 8列表框中

[英]Context Menu doesn't appear on windows phone 8 listbox

I am playing around with the context menu, i have installed the toolkit and i'm trying my first example with a listbox binded to a observable collection, in the item template i have the view of a item and the context menu, but it doesn't appear. 我正在使用上下文菜单,我已经安装了工具包,并且正在尝试将列表框绑定到可观察集合的第一个示例,在项目模板中,我可以查看项目和上下文菜单,但是它没有没有出现。 :/ Here's the code :/这是代码

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <ListBox x:Name="List" ItemsSource="{Binding Friends}" >
            <ListBox.DataContext>
                <ViewModel:MainViewModel/>
            </ListBox.DataContext>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <View:FriendItemView />
                    <toolkit:ContextMenuService.ContextMenu>
                        <toolkit:ContextMenu x:Name="Menu" Background="Black" >
                            <toolkit:MenuItem x:Name="Edit" Header="Edit" />
                            <toolkit:MenuItem x:Name="Delete" Header="Delete"/>
                        </toolkit:ContextMenu>
                    </toolkit:ContextMenuService.ContextMenu>
                </DataTemplate>
            </ListBox.ItemTemplate>

        </ListBox>
    </Grid>

尝试将ContextMenu放入FriendItemView中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM