I have an ItemsControl inside a UserControl, and my ItemsControl ItemTemplate consist of a button. I can get the button's binding command to work, but cannot get the ContextMenu inside the button to work. Can someone show me how my Binding should look inside my button's ContextMenu?
<ItemsControl ItemsSource="{Binding People}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Margin="0" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Command="{Binding DataContext.ShowPeopleDetailsAction, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
CommandParameter="{Binding CommandParameterIndex}" Background="Black" Cursor="Hand" Margin="1,0,14,10">
<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="Clear" Command="{Binding DataContext.ClearPeopleDetailsAction, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding CommandParameterIndex}" />
</ContextMenu>
</Button.ContextMenu>
<Button.Template>
<ControlTemplate>
<Grid>
<Image Source="/Resources;component/Images/people.png" Width="112"/>
<Label Content="{Binding PowerSupplyName, FallbackValue=default}"
Visibility="{Binding IsConfigured, Converter={StaticResource booleanToStringConverter}, FallbackValue=Visible}"
Foreground="White" FontWeight="Bold" Margin="0,15,0,0" Padding="0" HorizontalAlignment="Center" MaxWidth="110" />
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>