c# - How do I make ContextMenu in WPF throwing while Model3D objects touched only -


i have following xaml code:

<viewport3d.contextmenu>             <contextmenu>                 <menuitem header="cut"/>             </contextmenu> </viewport3d.contextmenu> 

when click viewport3d context menu, how make visible when touch model3d object, placed on viewport3d element. (i have several model3d objects, , need context menu when of them getting mouse click)

so on issue added contextmenuopening event handler

<viewport3d           contextmenuopening="contextmenuopen" 

and code behind

private void contextmenuopen(object sender, contextmenueventargs e)     {         point location = mouse.getposition(myviewport);         hittestresult hit = visualtreehelper.hittest(myviewport, location);         var meshit = hit raymeshgeometry3dhittestresult;         surfaceinfo inf = model3d.findinfo(meshit.modelhit);         if (inf == null) // if model3d object weren't touched          {             e.handled = true;         }     } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -