Set selected item on ContextMenu open action wp7
How I can set selected item or get listbox item in which I have ContextMenu?
<local:TypeTemplateSelector Content="{Binding}">
<local:TypeTemplateSelector.WithAudio>
<DataTemplate>
<Grid Margin="0,5">
开发者_运维百科 <toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu Open="needselect" x:Name="databoundMenu">
<toolkit:MenuItem Header="I Like It"/>
<toolkit:MenuItem>
<toolkit:MenuItem.Header>
<CheckBox Content="Tell" ></CheckBox>
</toolkit:MenuItem.Header>
</toolkit:MenuItem>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
<StackPanel>
<TextBlock Text="{Binding h}"/>
</StackPanel>
</Grid>
</DataTemplate>
</local:TypeTemplateSelector.WithAudio>
I'm not sure if I understand your question: you have a listbox in which each item has a contextmenu and in the context menu you want to know the selected item ? Here's my usage of the contextmenu
<DataTemplate>
<Border>
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>
<toolkit:MenuItem Header="Move" Command="{Binding MoveCurrentCommand}" CommandParameter="{Binding}" />
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
<Grid Margin="0,0,0,15" Height="100">
(...)
精彩评论