0
我得到了一个水平的ListBox来显示图片。我想在每个项目上添加一个ContextMenu,允许用户删除该项目。但我不知道我的ContextMenu在我的ItemTemplate中的确切位置,我几乎在任何地方尝试过,但ContextMenu从不在Holding上显示。 你知道在哪里放置XAML组?列表框中的WP8 ContextMenu没有显示
<ListBox x:Name="PhotoListBox" Grid.Row="1" ItemsSource="{Binding}" SelectionChanged="PhotoListBox_SelectionChanged" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel
HorizontalAlignment="Left"
Margin="0,0,0,0"
VerticalAlignment="Top"
/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="5">
<StackPanel Orientation="Vertical">
<Grid Width="100" Height="100">
<Grid.Background>
<ImageBrush Stretch="UniformToFill" ImageSource="{Binding}" />
</Grid.Background>
<toolkit:ContextMenu>
<toolkit:MenuItem Header="Delete" Click="MenuItem_OnClick"/>
</toolkit:ContextMenu>
</Grid>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
感谢
谢谢你,它的工作原理! – bviale