我实际上是想在我的Windows Phone 8应用程序中的LongListSelector中实现ContextMenu。 这就是我在做的事情。我无法理解为什么根本没有显示上下文菜单。我如何使其工作? :/
<phone:LongListSelector Name="Storico" HorizontalAlignment="Left" Height="384" Margin="39,254,0,0" VerticalAlignment="Top" Width="406" BorderBrush="#FFFF2800" Tap="Storico_Tap">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" Width="420" Height="40" Foreground="#FFFF9000" FontSize="30" ManipulationStarted="TextBlock_ManipulationStarted" ManipulationCompleted="TextBlock_ManipulationCompleted"/>
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu Name="ContextMenu" >
<toolkit:MenuItem Name="Watch" Header="Watch Trailer"/>
<toolkit:MenuItem Name="Buy" Header="Buy"/>
<toolkit:MenuItem Name="Share" Header="Share"/>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
提前致谢
答案 0 :(得分:1)
尝试将ContextMenu添加到TextBlock?
<TextBlock Text="{Binding Name}" Width="420" Height="40" Foreground="#FFFF9000" FontSize="30" ManipulationStarted="TextBlock_ManipulationStarted" ManipulationCompleted="TextBlock_ManipulationCompleted">
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu Name="ContextMenu" >
<toolkit:MenuItem Name="Watch" Header="Watch Trailer"/>
<toolkit:MenuItem Name="Buy" Header="Buy"/>
<toolkit:MenuItem Name="Share" Header="Share"/>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
</TextBlock>