<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Right-click Context Menu for GraphicLayers in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254500#M6611</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How I load this ContextMenu when user make a right Click? Any code snippet? Please share&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Nov 2014 01:12:30 GMT</pubDate>
    <dc:creator>AnandKirti</dc:creator>
    <dc:date>2014-11-07T01:12:30Z</dc:date>
    <item>
      <title>Right-click Context Menu for GraphicLayers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254495#M6606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We would like the ability to create a right-click context menu for Graphics from a GraphicLayer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems that we cannot use the .NET Framework &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.controls.contextmenu%28v=vs.85%29.aspx"&gt;ContextMenu&lt;/A&gt;&lt;SPAN&gt; class since it requires an UIElement for the &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.controls.contextmenu.placementtarget%28v=vs.85%29.aspx"&gt;PlacementTarget&lt;/A&gt;&lt;SPAN&gt; property.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to integrate a right-click context menu into my map?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Mar 2011 18:30:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254495#M6606</guid>
      <dc:creator>FrancoisChartrand</dc:creator>
      <dc:date>2011-03-14T18:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Right-click Context Menu for GraphicLayers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254496#M6607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This one has become my best friend.&amp;nbsp; Plus you can get the source code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://sl4popupmenu.codeplex.com/"&gt;http://sl4popupmenu.codeplex.com/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good Luck&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Mar 2011 19:33:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254496#M6607</guid>
      <dc:creator>BrentHoskisson</dc:creator>
      <dc:date>2011-03-14T19:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Right-click Context Menu for GraphicLayers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254497#M6608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I found some ways to do add Context Menus.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The easiest way is to add the Context Menu to the Symbol's ControlTemplate. However, when doing&amp;nbsp; this, I haven't found a way to retrieve the Graphic object when executing the Context Menu's Command which is sad because you won't be able to give some context to the Command.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second way is to do it by code by creating your own Graphic class. You won't be able to set the PlacementTarget property because the ArcGIS API doesn't give you access to the corresponding UIElement but it doesn't seem to make any difference since the ContextMenu will show up properly. In addition, by doing it this way, it is very easy to set the CommandParameter to the Graphic object. Here is the code for the second option:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;class MyGraphic : ESRI.ArcGIS.Client.Graphic
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public MyGraphic()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MouseRightButtonUp += (sender, e) =&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ContextMenu contextMenu = BuildContextMenu();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contextMenu.IsOpen = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Handled = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; private ContextMenu BuildContextMenu()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ContextMenu contextMenu = new ContextMenu();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BuildContextMenuCore(contextMenu);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return contextMenu;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; protected virtual void BuildContextMenuCore(ContextMenu contextMenu)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contextMenu.Items.Add(new MenuItem
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Header = "Properties",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CommandParameter = this,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Command = Commands.Map.Properties
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please let me know if you find a better way...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:34:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254497#M6608</guid>
      <dc:creator>FrancoisChartrand</dc:creator>
      <dc:date>2021-12-11T12:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Right-click Context Menu for GraphicLayers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254498#M6609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The Graphics Layer has a MouseRightButtonDown.&amp;nbsp; It doesn't mean you have to use the graphic as the UI Element.&amp;nbsp; The Map can be the UI Element.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know how the context menu you are using works, but, with mine, I can:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;grab the graphics information from the EventArgs and set up the popup accordingly, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;set the location of the context also from the event args and &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;open the popup on the Map control - it will come up over the graphic and the user wont care.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good Luck.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2011 19:33:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254498#M6609</guid>
      <dc:creator>BrentHoskisson</dc:creator>
      <dc:date>2011-03-23T19:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Right-click Context Menu for GraphicLayers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254499#M6610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Brent for your help. You are right: I could also use the MouseRightButtonUp from the Graphics Layer and use the EventArgs to retrieve the graphics information.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I can't use the Map itself as the UIElement for the &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.controls.contextmenu.placementtarget.aspx"&gt;PlacementTarget&lt;/A&gt;&lt;SPAN&gt; property. The PlacementTarget is the element relative to which the ContextMenu is positioned when it opens. Setting it to the map wouldn't make sense.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using the standard &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.controls.contextmenu.aspx"&gt;ContextMenu&lt;/A&gt;&lt;SPAN&gt; class from the .NET Framework. I should also mention that I'm developing a WPF application, not Silverlight.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Mar 2011 11:51:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254499#M6610</guid>
      <dc:creator>FrancoisChartrand</dc:creator>
      <dc:date>2011-03-24T11:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Right-click Context Menu for GraphicLayers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254500#M6611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How I load this ContextMenu when user make a right Click? Any code snippet? Please share&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Nov 2014 01:12:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254500#M6611</guid>
      <dc:creator>AnandKirti</dc:creator>
      <dc:date>2014-11-07T01:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Right-click Context Menu for GraphicLayers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254501#M6612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;How I load this ContextMenu when user make a right Click? Any code snippet? Please share&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Nov 2014 01:12:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/right-click-context-menu-for-graphiclayers/m-p/254501#M6612</guid>
      <dc:creator>AnandKirti</dc:creator>
      <dc:date>2014-11-07T01:12:53Z</dc:date>
    </item>
  </channel>
</rss>

