简体   繁体   中英

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中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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