Windows phone 7 如何在列表框wp7中打开关联菜单
我有一个列表框,当我长按列表框的特定项时,会打开一个上下文菜单。但是在listbox中,我没有使用listbox的点击或保持事件,因此我的上下文菜单是如何显示的 请告诉我哪个事件正在触发,哪个事件打开了我的上下文菜单;xaml代码是:Windows phone 7 如何在列表框wp7中打开关联菜单,windows-phone-7,Windows Phone 7,我有一个列表框,当我长按列表框的特定项时,会打开一个上下文菜单。但是在listbox中,我没有使用listbox的点击或保持事件,因此我的上下文菜单是如何显示的 请告诉我哪个事件正在触发,哪个事件打开了我的上下文菜单;xaml代码是: <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <ListBox x:Name="scheduleListbox" ItemsSource="{Binding sc
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<ListBox x:Name="scheduleListbox" ItemsSource="{Binding scheduleList}" Tap="scheduleListbox_Tap">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Height="150" Width="460">
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu >
<toolkit:MenuItem Header="Add To Calendar" Click="AddToCalendar_Click" />
<toolkit:MenuItem Header="View Description" Click="ViewDescription_Click" />
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
<TextBlock x:Name="textBlock1" Text="{Binding ScheduleName}" Foreground="WhiteSmoke" FontSize="32"/>
<TextBlock x:Name="textBlock2" Text="{Binding ScheduleDate}" Foreground="Red" Margin="0,10,0,0"/>
<StackPanel Orientation="Horizontal" Height="70" Width="460">
<TextBlock x:Name="textBlock3" Text="{Binding StartTime}" Margin="0,5,0,0"/>
<TextBlock x:Name="textBlock4" Text="{Binding EndTime}" Margin="50,5,0,0"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
请告诉我的上下文菜单是如何打开的,因为我没有使用listbox的点击或保持事件,但当我长按listbox项目时,上下文菜单打开?默认情况下,上下文菜单在长时间保持时打开,这是设计的。如果您希望以任何其他方式打开它,您必须编写自己的逻辑。有关如何执行此操作的示例,请参见以下线程: