locked
ContextMenu Problems for Child Controls in a CustomActivityDesigner RRS feed

  • Question

  • I have a TextBox inside a CustomActivityDesigner. I am rehosting the WorkflowDesigner in a WPF application. I cannot seem to get the ContextMenu for the TextBox to do anything other than display the ContextMenu for the Activity/WorkflowDesigner. I've seen some code solutions about to add MenuItems to the WorkflowDesigner's ContextMenu. This is not what I want  to do, I simply want to get the context menu for the TextBox inside the Designer.

    Can anyone point me in the right direction on this? 

     

    Thanks


    - jeremiah adams
    Thursday, December 8, 2011 8:57 PM

Answers

  • From a quick look, I think this is a a bug in WorkflowDesigner's context menu handling, it would be great if you could file this on connect.microsoft.com/wf. With a link to this forum post.

    I think you might be able to work around the issue by overriding certain wpf context menu related events like OnContextMenuOpening in your ActivityDesigner class - which might let you suppress the event bubbling up to the WorkflowDesigner control - so far far I've got the theory that control's OnContextMenuOpening override is what triggers the madness.
    Tim

    • Marked as answer by jeremiahAdams Monday, December 12, 2011 9:15 PM
    Saturday, December 10, 2011 4:26 AM

All replies

  • Hi,

     

    I hope you are using wpf (xaml) custom activity designer for your custom activity , which contains a text box for which you want to create custom contect menu.

    http://msdn.microsoft.com/en-us/library/dd489419.aspx

    I think you can ad custom Context menu to your text box.

    please follow this link.

    http://msdn.microsoft.com/en-us/library/ms750420(v=VS.90).aspx

    Thanks,

    Madhur

     


    MB
    Friday, December 9, 2011 12:02 PM
  • Please see the trivial example project at the url below:

    https://sites.google.com/site/jeremiahsscratchpad/WorkflowEditor.zip?attredirects=0&d=1

     

    Build and run it. Once open, drag and drop a "LaunchExternalAppActivitiy" from the CustomActivites onto the re-hosted designer. Then right click the the VB expression boxes and the TextBox.


    Notice Two Things: 1 - the VB Expression boxes have no ContextMenu. 2 - The TextBox has the same ContextMenu that the ActivityDesigner has. I have added a ContextMenu via XAML to all three UIElements.

     

    My question is - how to I get the ContextMenu for the TextBox to display the Textbox's ContextMenu instead of the ActivityDesigner's ContextMenu?

     

     


    - jeremiah adams
    Friday, December 9, 2011 6:56 PM
  • From a quick look, I think this is a a bug in WorkflowDesigner's context menu handling, it would be great if you could file this on connect.microsoft.com/wf. With a link to this forum post.

    I think you might be able to work around the issue by overriding certain wpf context menu related events like OnContextMenuOpening in your ActivityDesigner class - which might let you suppress the event bubbling up to the WorkflowDesigner control - so far far I've got the theory that control's OnContextMenuOpening override is what triggers the madness.
    Tim

    • Marked as answer by jeremiahAdams Monday, December 12, 2011 9:15 PM
    Saturday, December 10, 2011 4:26 AM
  • Thanks Tim,

     

    I've filed it with connect here: https://connect.microsoft.com/wf/feedback/details/713428/contextmenu-for-uielements-broken-in-custom-activity-designers

     

    I am reluctant to put into some place some elaborate workaround that will be useless later when the bug is correct. If I get some extra time I may see about applying your proposed work around for a fix.


    - jeremiah adams
    Monday, December 12, 2011 9:14 PM