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

  • Home
  • SEARCH
  • 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 6179787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:43:51+00:00 2026-05-24T00:43:51+00:00

I am building a both Silverlight and WPF clients for our project. When I

  • 0

I am building a both Silverlight and WPF clients for our project.

When I try to assign context menus for controls, it seems to me that a context menu can be assigned only to one control at a time, is that true?

E.g. when I am drawing several lines

ContextMenu contextMenu = CreateLineMenu();

for (int i = 0; i < Points.Count - 1; i++)
        {
            Line l = new Line();
            ...
            canvas.Children.Add(l);
            ContextMenuService.SetContextMenu(l, contextMenu);
            }
        }

The menu works only for the line added as last.

  • 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-24T00:43:52+00:00Added an answer on May 24, 2026 at 12:43 am

    A single context menu can only be assigned to one parent object at a time as it is just added into the visual tree under that child (and no visual element can have multiple parents in SL/WPF).

    If you look at how context menus are defined in XAML this will become clearer.

    To share one instance of a context menu you would need to dynamically assign it (e.g. when the mouse right button is clicked, or some other event).

    This does seem a very inefficient way to define context menus, so I am sure others have created generic ways to share them… keep on searching (I will).

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

Sidebar

Related Questions

I'm building a set of assemblies that need to work on both Silverlight and
We're building a Silverlight 4 LOB application. However, we're concerned that not all our
I'm building a basic CRUD library, that I anticipate use in both local (add
We are building a PhoneGap app (both for iOS and Android) that has a
I am building an AJAX application that uses both HTTP Content and HTTP Header
We are building a mobile application that needs to work on both Android and
I’m building a WPF application using MVVM pattern (both are new technologies for me).
I'm building a Hadoop (0.20.1) mapreduce job that uses HBase (0.20.1) as both the
I'm building an Objective-C app that has both a server and a client. The
I'm building a site that has one authentication system for both general users and

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.