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 1005583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:19:14+00:00 2026-05-16T08:19:14+00:00

I have a context menu that is defined as a resource and bound to

  • 0

I have a context menu that is defined as a resource and bound to the SelectedItem in a DataGrid, using a converter to get the display name of the current item, as in “Edit ” or “Edit “

It works fine for the first selected item, but doesn’t call the converter on the second (I have a break point in it that only gets hit on the first pass). BUT if I invoke the bound command on the second pass, it invokes on the newly selected instance as it should.

I use this technique with other ItemsControls and I can’t spot anything wrong. Any ideas?

Cheers,
Berryl

Resource & binding

<ContextMenu x:Key="ProjectActivityContextMenu" x:Shared="true">
    ...
    <MenuItem Header="{Binding SelectedProjectActivity, Converter={StaticResource DeleteProjectConv}}" Command="{Binding DeleteCommand}" />
</ContextMenu>

Wiring

<DataGrid ...
    SelectedItem="{Binding SelectedProjectActivity}" 
    IsSynchronizedWithCurrentItem="True" 
    ContextMenu="{DynamicResource ProjectActivityContextMenu}"
 >

UPDATE

This also happens if I declare it as part of the grid, like:

<DataGrid.ContextMenu>
    <ContextMenu >
    ....
    <MenuItem Header="{Binding SelectedProjectActivity, Converter={StaticResource DeleteProjectConv}}" Command="{Binding DeleteCommand}" />
                </ContextMenu>
</DataGrid.ContextMenu>
  • 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-16T08:19:15+00:00Added an answer on May 16, 2026 at 8:19 am

    I think what you’re seeing is just a consequence of defining the ContextMenu as a Resource. Until you actually open the menu, it has no DataContext to apply the Bindings to so the converter isn’t being called. This should hold even if you change the selection a few times without opening the menu. Once you right click and open the menu the DataContext is applied and the Bindings can be resolved.

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

Sidebar

Related Questions

No related questions found

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.