locked
Get an event in a rehosted designer for Activity selection RRS feed

  • Question

  • I can't seem to find the equivalent of the ISelectionService from version 3.5.

    How do you detect an activity being selected in your rehosting app?
    Jason Bolstad
    Monday, November 30, 2009 3:40 AM

Answers

  • Jason,

    Really simply, inside the editing context items there is a selection object published.  From your host subscribe to the item and you can get notified of changes.  In the code below, I am simply providing a lambda that sets a combo box items to the selected items.

    wd.Context.Items.Subscribe<Selection> (sel => SelectedItems.ItemsSource = sel.SelectedObjects);
    You can also just get the Selection item from the Items collection and inspect it, or you can explicitly set it to a model item of your choosing and the designer will update accordingly.

    matt
    Program Manager -- wf designer -- http://blogs.msdn.com/mwinkle
    • Proposed as answer by kushals Monday, November 30, 2009 5:57 PM
    • Marked as answer by Jason Bolstad Monday, November 30, 2009 10:13 PM
    Monday, November 30, 2009 3:49 AM

All replies

  • Jason,

    Really simply, inside the editing context items there is a selection object published.  From your host subscribe to the item and you can get notified of changes.  In the code below, I am simply providing a lambda that sets a combo box items to the selected items.

    wd.Context.Items.Subscribe<Selection> (sel => SelectedItems.ItemsSource = sel.SelectedObjects);
    You can also just get the Selection item from the Items collection and inspect it, or you can explicitly set it to a model item of your choosing and the designer will update accordingly.

    matt
    Program Manager -- wf designer -- http://blogs.msdn.com/mwinkle
    • Proposed as answer by kushals Monday, November 30, 2009 5:57 PM
    • Marked as answer by Jason Bolstad Monday, November 30, 2009 10:13 PM
    Monday, November 30, 2009 3:49 AM
  • Matt,

    How do I get to   " editing context items " you are referring to in your reply? if you give n example that would be so helpful.  Thanks in advance.  I am a beginner in WF . 


    TaMa

    Friday, September 27, 2013 7:21 PM
  • The editing context items is just

    WorkflowDesinger.Context.Items

    Basically just paste the line in Matts example into your workflowDesigner class code somewhere after you have loaded the workflow.


    Jason Bolstad

    Sunday, September 29, 2013 7:33 PM