Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7194963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:28:55+00:00 2026-05-28T20:28:55+00:00

I have a ContextMenu (from the Silverlight Toolkit) inside a DataTemplate used as the

  • 0

I have a ContextMenu (from the Silverlight Toolkit) inside a DataTemplate used as the ItemTemplate of a ListBox:

<DataTemplate x:Key="BillItemDataTemplate">
  <Grid Margin="0,0,0,12" x:Name="ItemGrid">
    <kit:ContextMenuService.ContextMenu>
      <kit:ContextMenu>
        <kit:MenuItem Header="delete item" 
                      Command="{Binding ???????.DeleteItemCommand}"
                      CommandParameter="{Binding}" />
      </kit:ContextMenu>
    </kit:ContextMenuService.ContextMenu>
    [...]
  </Grid>
</DataTemplate>

How can I tell the ContextMenu.Command to bind to a property on the view-model exposed by the outer DataContext (i.e. the one that applies to the ListBox)? If I’m right, I cannot use WPF relative declarations as explained here.

I would prefer if my child view-models wouldn’t require a reference to the “parent” view-model.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:28:56+00:00Added an answer on May 28, 2026 at 8:28 pm

    For the record, I’ve taken the habit of having an ICommand property on every child view-model, set to the parent ICommand when each is created, again with CommandParameter="{Binding}".

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datagrid and I added silverlight 4 toolkit contextmenu to textbox in
I have a Contextmenu with a ListBox inside. Whenever I right click my control
When I use ContextMenu from Silverlight 4 Toolkit I want to get ContextMenu instance's
I'm using the ContextMenu control from the Silverlight Toolkit, and I'd like to define
Inside my control, I have: ContextMenu = new ContextMenu(); ContextMenu.MenuItems.Add(new MenuItem(&Add Item, onAddSpeaker)); ContextMenu.MenuItems.Add(new
I have a DataTemplate containing an Image. To the Image I added a ContextMenu
I have a ListBox with items, and have assigned a ContextMenu to it with
I have a ContextMenu that can be opened from 2 different StackPanel's, how can
This is probably an easy one... I have a Listbox with a ContextMenu embedded
I have a contextMenu set up and it shows items from the list. However,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.